mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-19 14:19:57 +01:00
Tooltips in Texture View
Unified UX for Views with menu; show tooltip in TextureView as it is in DisplaysView
This commit is contained in:
@@ -38,7 +38,8 @@ std::vector< ShadingProgram > maskPrograms = {
|
|||||||
ShadingProgram("shaders/simple.vs", "shaders/mask_vertical.fs")
|
ShadingProgram("shaders/simple.vs", "shaders/mask_vertical.fs")
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* MaskShader::mask_names[3] = { ICON_FA_EXPAND, ICON_FA_EDIT, ICON_FA_SHAPES };
|
const char* MaskShader::mask_icons[3] = { ICON_FA_SQUARE, ICON_FA_EDIT, ICON_FA_SHAPES };
|
||||||
|
const char* MaskShader::mask_names[3] = { "No mask", "Paint mask", "Shape mask" };
|
||||||
const char* MaskShader::mask_shapes[5] = { "Ellipse", "Oblong", "Rectangle", "Horizontal", "Vertical" };
|
const char* MaskShader::mask_shapes[5] = { "Ellipse", "Oblong", "Rectangle", "Horizontal", "Vertical" };
|
||||||
|
|
||||||
ImageShader::ImageShader(): Shader(), mask_texture(0), stipple(0.f)
|
ImageShader::ImageShader(): Shader(), mask_texture(0), stipple(0.f)
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public:
|
|||||||
glm::vec4 cursor;
|
glm::vec4 cursor;
|
||||||
glm::vec3 brush;
|
glm::vec3 brush;
|
||||||
|
|
||||||
|
static const char* mask_icons[3];
|
||||||
static const char* mask_names[3];
|
static const char* mask_names[3];
|
||||||
static const char* mask_shapes[5];
|
static const char* mask_shapes[5];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -598,7 +598,12 @@ void TextureView::draw()
|
|||||||
|
|
||||||
int mode = edit_source_->maskShader()->mode;
|
int mode = edit_source_->maskShader()->mode;
|
||||||
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
|
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
|
||||||
if ( ImGui::Combo("##Mask", &mode, MaskShader::mask_names, IM_ARRAYSIZE(MaskShader::mask_names) ) ) {
|
|
||||||
|
if (ImGui::BeginCombo("##Mask", MaskShader::mask_icons[mode])) {
|
||||||
|
|
||||||
|
for (int m = 0; m < 3; ++m){
|
||||||
|
if (ImGui::Selectable( MaskShader::mask_icons[m] )) {
|
||||||
|
mode = m;
|
||||||
edit_source_->maskShader()->mode = mode;
|
edit_source_->maskShader()->mode = mode;
|
||||||
if (mode == MaskShader::NONE)
|
if (mode == MaskShader::NONE)
|
||||||
Mixer::manager().setCurrentSource(edit_source_);
|
Mixer::manager().setCurrentSource(edit_source_);
|
||||||
@@ -608,43 +613,37 @@ void TextureView::draw()
|
|||||||
need_edit_update_ = true;
|
need_edit_update_ = true;
|
||||||
// store action history
|
// store action history
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << edit_source_->name() << ": Mask " << (mode>1?"Shape":(mode>0?"Paint":"None"));
|
oss << edit_source_->name() << ": " << MaskShader::mask_names[mode];
|
||||||
Action::manager().store(oss.str());
|
Action::manager().store(oss.str());
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip(MaskShader::mask_names[m]);
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
// GUI for drawing mask
|
// GUI for drawing mask
|
||||||
if (edit_source_->maskShader()->mode == MaskShader::PAINT) {
|
if (edit_source_->maskShader()->mode == MaskShader::PAINT) {
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGuiToolkit::HelpToolTip( ICON_FA_EDIT "\tMask paint \n\n"
|
|
||||||
ICON_FA_MOUSE_POINTER "\t Edit texture\n"
|
|
||||||
ICON_FA_PAINT_BRUSH "\tBrush\n"
|
|
||||||
ICON_FA_ERASER "\tEraser\n\n"
|
|
||||||
ICON_FA_CIRCLE "\tBrush shape\n"
|
|
||||||
ICON_FA_DOT_CIRCLE "\tBrush size\n"
|
|
||||||
ICON_FA_FEATHER_ALT "\tBrush Pressure\n\n"
|
|
||||||
ICON_FA_MAGIC "\tEffects\n"
|
|
||||||
ICON_FA_FOLDER_OPEN "\tOpen image");
|
|
||||||
|
|
||||||
// select cursor
|
// select cursor
|
||||||
static bool on = true;
|
static bool on = true;
|
||||||
ImGui::SameLine(0, 60);
|
ImGui::SameLine(0, 60);
|
||||||
on = mask_cursor_paint_ == 0;
|
on = mask_cursor_paint_ == 0;
|
||||||
if (ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on)) {
|
if (ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on, "Edit texture")) {
|
||||||
Mixer::manager().setCurrentSource(edit_source_);
|
Mixer::manager().setCurrentSource(edit_source_);
|
||||||
mask_cursor_paint_ = 0;
|
mask_cursor_paint_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
on = mask_cursor_paint_ == 1;
|
on = mask_cursor_paint_ == 1;
|
||||||
if (ImGuiToolkit::ButtonToggle(ICON_FA_PAINT_BRUSH, &on)) {
|
if (ImGuiToolkit::ButtonToggle(ICON_FA_PAINT_BRUSH, &on, "Brush")) {
|
||||||
Mixer::manager().unsetCurrentSource();
|
Mixer::manager().unsetCurrentSource();
|
||||||
mask_cursor_paint_ = 1;
|
mask_cursor_paint_ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
on = mask_cursor_paint_ == 2;
|
on = mask_cursor_paint_ == 2;
|
||||||
if (ImGuiToolkit::ButtonToggle(ICON_FA_ERASER, &on)) {
|
if (ImGuiToolkit::ButtonToggle(ICON_FA_ERASER, &on, "Eraser")) {
|
||||||
Mixer::manager().unsetCurrentSource();
|
Mixer::manager().unsetCurrentSource();
|
||||||
mask_cursor_paint_ = 2;
|
mask_cursor_paint_ = 2;
|
||||||
}
|
}
|
||||||
@@ -659,11 +658,15 @@ void TextureView::draw()
|
|||||||
if(ImGui::Combo("##BrushShape", &item, items, IM_ARRAYSIZE(items))) {
|
if(ImGui::Combo("##BrushShape", &item, items, IM_ARRAYSIZE(items))) {
|
||||||
Settings::application.brush.z = float(item);
|
Settings::application.brush.z = float(item);
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Shape");
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
show_cursor_forced_ = false;
|
show_cursor_forced_ = false;
|
||||||
if (ImGui::Button(ICON_FA_DOT_CIRCLE ICON_FA_SORT_DOWN ))
|
if (ImGui::Button(ICON_FA_DOT_CIRCLE ICON_FA_SORT_DOWN ))
|
||||||
ImGui::OpenPopup("brush_size_popup");
|
ImGui::OpenPopup("brush_size_popup");
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Size");
|
||||||
if (ImGui::BeginPopup("brush_size_popup", ImGuiWindowFlags_NoMove))
|
if (ImGui::BeginPopup("brush_size_popup", ImGuiWindowFlags_NoMove))
|
||||||
{
|
{
|
||||||
int pixel_size_min = int(0.05 * edit_source_->frame()->height() );
|
int pixel_size_min = int(0.05 * edit_source_->frame()->height() );
|
||||||
@@ -692,6 +695,8 @@ void TextureView::draw()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_FEATHER_ALT ICON_FA_SORT_DOWN ))
|
if (ImGui::Button(ICON_FA_FEATHER_ALT ICON_FA_SORT_DOWN ))
|
||||||
ImGui::OpenPopup("brush_pressure_popup");
|
ImGui::OpenPopup("brush_pressure_popup");
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Pressure");
|
||||||
if (ImGui::BeginPopup("brush_pressure_popup", ImGuiWindowFlags_NoMove))
|
if (ImGui::BeginPopup("brush_pressure_popup", ImGuiWindowFlags_NoMove))
|
||||||
{
|
{
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
||||||
@@ -714,23 +719,25 @@ void TextureView::draw()
|
|||||||
|
|
||||||
// menu for effects
|
// menu for effects
|
||||||
ImGui::SameLine(0, 60);
|
ImGui::SameLine(0, 60);
|
||||||
if (ImGui::Button(ICON_FA_MAGIC ICON_FA_SORT_DOWN ))
|
if (ImGui::Button(ICON_FA_PAINT_ROLLER ICON_FA_SORT_DOWN ))
|
||||||
ImGui::OpenPopup( "brush_menu_popup" );
|
ImGui::OpenPopup( "brush_menu_popup" );
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Operations");
|
||||||
if (ImGui::BeginPopup( "brush_menu_popup" ))
|
if (ImGui::BeginPopup( "brush_menu_popup" ))
|
||||||
{
|
{
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << edit_source_->name();
|
oss << edit_source_->name();
|
||||||
int e = 0;
|
int e = 0;
|
||||||
if (ImGui::Selectable( ICON_FA_BACKSPACE "\tClear")) {
|
if (ImGui::Selectable( ICON_FA_BACKSPACE " Clear")) {
|
||||||
e = 1;
|
e = 1;
|
||||||
oss << ": Clear " << MASK_PAINT_ACTION_LABEL;
|
oss << ": Clear " << MASK_PAINT_ACTION_LABEL;
|
||||||
}
|
}
|
||||||
if (ImGui::Selectable( ICON_FA_ADJUST "\tInvert")) {
|
if (ImGui::Selectable( ICON_FA_ADJUST " Invert")) {
|
||||||
e = 2;
|
e = 2;
|
||||||
oss << ": Invert " << MASK_PAINT_ACTION_LABEL;
|
oss << ": Invert " << MASK_PAINT_ACTION_LABEL;
|
||||||
}
|
}
|
||||||
if (ImGui::Selectable( ICON_FA_WAVE_SQUARE "\tEdge")) {
|
if (ImGui::Selectable( ICON_FA_WAVE_SQUARE " Edge")) {
|
||||||
e = 3;
|
e = 3;
|
||||||
oss << ": Edge " << MASK_PAINT_ACTION_LABEL;
|
oss << ": Edge " << MASK_PAINT_ACTION_LABEL;
|
||||||
}
|
}
|
||||||
@@ -749,6 +756,8 @@ void TextureView::draw()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_FOLDER_OPEN))
|
if (ImGui::Button(ICON_FA_FOLDER_OPEN))
|
||||||
maskdialog.open();
|
maskdialog.open();
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Open image");
|
||||||
if (maskdialog.closed() && !maskdialog.path().empty())
|
if (maskdialog.closed() && !maskdialog.path().empty())
|
||||||
{
|
{
|
||||||
FrameBufferImage *img = new FrameBufferImage(maskdialog.path());
|
FrameBufferImage *img = new FrameBufferImage(maskdialog.path());
|
||||||
@@ -773,18 +782,11 @@ void TextureView::draw()
|
|||||||
// GUI for all other masks
|
// GUI for all other masks
|
||||||
else if (edit_source_->maskShader()->mode == MaskShader::SHAPE) {
|
else if (edit_source_->maskShader()->mode == MaskShader::SHAPE) {
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGuiToolkit::HelpToolTip( ICON_FA_SHAPES "\tMask shape\n\n"
|
|
||||||
ICON_FA_MOUSE_POINTER "\t Edit texture\n"
|
|
||||||
ICON_FA_CROP_ALT "\tCrop & Edit shape\n\n"
|
|
||||||
ICON_FA_CARET_DOWN " \tShape of the mask\n"
|
|
||||||
ICON_FA_RADIATION_ALT "\tShape blur");
|
|
||||||
|
|
||||||
// select cursor
|
// select cursor
|
||||||
static bool on = true;
|
static bool on = true;
|
||||||
ImGui::SameLine(0, 60);
|
ImGui::SameLine(0, 60);
|
||||||
on = mask_cursor_shape_ == 0;
|
on = mask_cursor_shape_ == 0;
|
||||||
if (ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on)) {
|
if (ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on, "Edit texture")) {
|
||||||
Mixer::manager().setCurrentSource(edit_source_);
|
Mixer::manager().setCurrentSource(edit_source_);
|
||||||
need_edit_update_ = true;
|
need_edit_update_ = true;
|
||||||
mask_cursor_shape_ = 0;
|
mask_cursor_shape_ = 0;
|
||||||
@@ -792,7 +794,7 @@ void TextureView::draw()
|
|||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
on = mask_cursor_shape_ == 1;
|
on = mask_cursor_shape_ == 1;
|
||||||
if (ImGuiToolkit::ButtonToggle(ICON_FA_CROP_ALT, &on)) {
|
if (ImGuiToolkit::ButtonToggle(ICON_FA_CROP_ALT, &on, "Edit shape")) {
|
||||||
Mixer::manager().unsetCurrentSource();
|
Mixer::manager().unsetCurrentSource();
|
||||||
need_edit_update_ = true;
|
need_edit_update_ = true;
|
||||||
mask_cursor_shape_ = 1;
|
mask_cursor_shape_ = 1;
|
||||||
@@ -814,15 +816,19 @@ void TextureView::draw()
|
|||||||
oss << edit_source_->name() << ": Mask Shape " << MaskShader::mask_shapes[shape];
|
oss << edit_source_->name() << ": Mask Shape " << MaskShader::mask_shapes[shape];
|
||||||
Action::manager().store(oss.str());
|
Action::manager().store(oss.str());
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Select shape");
|
||||||
|
|
||||||
ImGui::SameLine(0, 20);
|
ImGui::SameLine(0, 20);
|
||||||
if (ImGui::Button(ICON_FA_RADIATION_ALT ICON_FA_SORT_DOWN ))
|
if (ImGui::Button(ICON_FA_RADIATION_ALT ICON_FA_SORT_DOWN ))
|
||||||
ImGui::OpenPopup("shape_smooth_popup");
|
ImGui::OpenPopup("shape_smooth_popup");
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
ImGuiToolkit::ToolTip("Blur");
|
||||||
if (ImGui::BeginPopup("shape_smooth_popup", ImGuiWindowFlags_NoMove))
|
if (ImGui::BeginPopup("shape_smooth_popup", ImGuiWindowFlags_NoMove))
|
||||||
{
|
{
|
||||||
static bool smoothchanged = false;
|
static bool smoothchanged = false;
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
||||||
ImGuiToolkit::Indication("Blur ", 7, 16, ICON_FA_ARROW_UP);
|
ImGuiToolkit::Indication("Blured ", 7, 16, ICON_FA_ARROW_UP);
|
||||||
if (ImGui::VSliderInt("##shapeblur", ImVec2(30,260), &blur_percent, 0, 100, "") ){
|
if (ImGui::VSliderInt("##shapeblur", ImVec2(30,260), &blur_percent, 0, 100, "") ){
|
||||||
edit_source_->maskShader()->blur = float(blur_percent) / 100.f;
|
edit_source_->maskShader()->blur = float(blur_percent) / 100.f;
|
||||||
edit_source_->touch();
|
edit_source_->touch();
|
||||||
@@ -856,13 +862,10 @@ void TextureView::draw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {// mode == MaskShader::NONE
|
else {// mode == MaskShader::NONE
|
||||||
ImGui::SameLine();
|
|
||||||
ImGuiToolkit::HelpToolTip( ICON_FA_EXPAND "\tNo mask\n\n"
|
|
||||||
ICON_FA_MOUSE_POINTER "\t Edit texture\n");
|
|
||||||
// always active mouse pointer
|
// always active mouse pointer
|
||||||
ImGui::SameLine(0, 60);
|
ImGui::SameLine(0, 60);
|
||||||
bool on = true;
|
bool on = true;
|
||||||
ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on);
|
ImGuiToolkit::ButtonToggle(ICON_FA_MOUSE_POINTER, &on, "Edit texture");
|
||||||
ImGui::SameLine(0, 60);
|
ImGui::SameLine(0, 60);
|
||||||
ImGui::TextDisabled( "No mask" );
|
ImGui::TextDisabled( "No mask" );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user