diff --git a/Decorations.cpp b/Decorations.cpp index 792310f..31f5c4b 100644 --- a/Decorations.cpp +++ b/Decorations.cpp @@ -574,7 +574,7 @@ void Disk::accept(Visitor& v) Surface *Glyph::font_ = nullptr; -Glyph::Glyph(int imgui_font_index) : Node(), character_(' '), font_index_(imgui_font_index), ar_(1.f) +Glyph::Glyph(int imgui_font_index) : Node(), character_(' '), font_index_(imgui_font_index), baseline_(0.f), shape_(1.f, 1.f) { if (Glyph::font_ == nullptr) Glyph::font_ = new Surface; @@ -619,14 +619,14 @@ void Glyph::draw(glm::mat4 modelview, glm::mat4 projection) // extract scaling ctm = glm::rotate(glm::identity(), -rot.z, glm::vec3(0.f, 0.f, 1.f)) * modelview ; vec = ctm * glm::vec4(1.f, 1.f, 0.f, 0.f); - glm::vec3 sca = glm::vec3(vec.y, vec.y, 1.f) * glm::vec3(scale_.y * ar_, scale_.y, 1.f); + glm::vec2 sca = glm::vec2(vec.y) * glm::vec2(scale_.y) * shape_; // extract translation glm::vec3 tran = glm::vec3(modelview[3][0], modelview[3][1], modelview[3][2]) ; - tran += translation_ * glm::vec3(vec); + tran += (translation_ + glm::vec3(0.f, baseline_ * scale_.y, 0.f) ) * glm::vec3(vec); // apply local rotation rot.z += rotation_.z; // generate matrix - ctm = GlmToolkit::transform(tran, rot, sca); + ctm = GlmToolkit::transform(tran, rot, glm::vec3(sca, 1.f)); Glyph::font_->draw( ctm, projection); } @@ -644,13 +644,16 @@ void Glyph::setChar(char c) myfont = io.Fonts->Fonts[font_index_]; const ImFontGlyph* glyph = myfont->FindGlyph(character_); - // create a texture UV transform to get the UV coordinates of the glyph - const glm::vec3 uv_t = glm::vec3( glyph->U0, glyph->V0, 0.f); - const glm::vec3 uv_s = glm::vec3( glyph->U1 - glyph->U0, glyph->V1 - glyph->V0, 1.f); - const glm::vec3 uv_r = glm::vec3(0.f, 0.f, 0.f); - uvTransform_ = GlmToolkit::transform(uv_t, uv_r, uv_s); + if (glyph) { + // create a texture UV transform to get the UV coordinates of the glyph + const glm::vec3 uv_t = glm::vec3( glyph->U0, glyph->V0, 0.f); + const glm::vec3 uv_s = glm::vec3( glyph->U1 - glyph->U0, glyph->V1 - glyph->V0, 1.f); + const glm::vec3 uv_r = glm::vec3(0.f, 0.f, 0.f); + uvTransform_ = GlmToolkit::transform(uv_t, uv_r, uv_s); - // remember aspect ratio - ar_ = (glyph->X1 - glyph->X0) / (glyph->Y1 - glyph->Y0); + // remember glyph shape + shape_ = glm::vec2(glyph->X1 - glyph->X0, glyph->Y1 - glyph->Y0) / myfont->FontSize; + baseline_ = -glyph->Y0 / myfont->FontSize; + } } } diff --git a/Decorations.h b/Decorations.h index b31c75c..db3df25 100644 --- a/Decorations.h +++ b/Decorations.h @@ -107,7 +107,8 @@ protected: char character_; int font_index_; - float ar_; + float baseline_; + glm::vec2 shape_; glm::mat4 uvTransform_; static Surface *font_; diff --git a/Source.cpp b/Source.cpp index 0e55503..5a97e88 100644 --- a/Source.cpp +++ b/Source.cpp @@ -145,12 +145,12 @@ Source::Source(uint64_t id) : SourceCore(), id_(id), ready_(false), symbol_(null // Glyphs show letters from the intials, with Font index 4 (LARGE) initial_0_ = new Glyph(4); - initial_0_->translation_ = glm::vec3(0.2f, 0.75f, 0.1f); - initial_0_->scale_.y = 0.15f; + initial_0_->translation_ = glm::vec3(0.2f, 0.8f, 0.1f); + initial_0_->scale_.y = 0.2f; groups_[View::MIXING]->attach(initial_0_); initial_1_ = new Glyph(4); - initial_1_->translation_ = glm::vec3(0.45f, 0.75f, 0.1f); - initial_1_->scale_.y = 0.15f; + initial_1_->translation_ = glm::vec3(0.4f, 0.8f, 0.1f); + initial_1_->scale_.y = 0.2f; groups_[View::MIXING]->attach(initial_1_); overlays_[View::MIXING] = new Group; diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 16460e3..6dfcbd6 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -4251,13 +4251,11 @@ void Navigator::RenderSourcePannel(Source *s) ImGui::Text("Source"); ImGui::PopFont(); -// ImGui::SetCursorPos(ImVec2(pannel_width_ - 35.f, 15.f)); -// const char *tooltip[2] = {"Pin pannel\nCurrent: double-clic on source", "Un-pin Pannel\nCurrent: single-clic on source"}; -// ImGuiToolkit::IconToggle(5,2,4,2, &Settings::application.pannel_stick, tooltip ); - + // index indicator ImGui::SetCursorPos(ImVec2(pannel_width_ - 35.f, 15.f)); - ImGui::Text("#%d", Mixer::manager().indexCurrentSource()); + ImGui::TextDisabled("#%d", Mixer::manager().indexCurrentSource()); + // name std::string sname = s->name(); ImGui::SetCursorPosY(width_); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); @@ -5480,12 +5478,6 @@ void Navigator::RenderMainPannelSettings() ImGuiToolkit::ButtonSwitch( ICON_FA_MOUSE_POINTER " Smooth cursor", &Settings::application.smooth_cursor); ImGuiToolkit::ButtonSwitch( ICON_FA_TACHOMETER_ALT " Metrics", &Settings::application.widget.stats); -#ifndef NDEBUG - ImGui::Text("Expert"); - ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_SHADEREDITOR, &Settings::application.widget.shader_editor, CTRL_MOD "E"); - ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_TOOLBOX, &Settings::application.widget.toolbox, CTRL_MOD "G"); - ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_LOGS, &Settings::application.widget.logs, CTRL_MOD "L"); -#endif // // Recording preferences //