Separate general GUI managing code and global configuration from toolbar UI code
This commit is contained in:
parent
2abe7271a8
commit
ea35397326
53 changed files with 859 additions and 788 deletions
|
|
@ -328,23 +328,25 @@ void DrawingProgram::toolbar_gui() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = world.main.toolbar;
|
||||
t.gui.new_id("Drawing Program Toolbar GUI", [&] {
|
||||
t.gui.element<LayoutElement>("Drawing Program Toolbar GUI", [&] {
|
||||
GUIManager& gui = world.main.g.gui;
|
||||
auto& io = gui.io;
|
||||
|
||||
gui.new_id("Drawing Program Toolbar GUI", [&] {
|
||||
gui.element<LayoutElement>("Drawing Program Toolbar GUI", [&] {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)},
|
||||
.padding = CLAY_PADDING_ALL(static_cast<uint16_t>(t.io->theme->padding1 / 2)),
|
||||
.childGap = static_cast<uint16_t>(t.io->theme->childGap1 / 2),
|
||||
.padding = CLAY_PADDING_ALL(static_cast<uint16_t>(io.theme->padding1 / 2)),
|
||||
.childGap = static_cast<uint16_t>(io.theme->childGap1 / 2),
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(t.io->theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(t.io->theme->windowCorners1)
|
||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
||||
}) {
|
||||
|
||||
auto tool_button = [&](const char* id, const std::string& svgPath, DrawingProgramToolType toolType) {
|
||||
svg_icon_button(t.gui, id, svgPath, {
|
||||
svg_icon_button(gui, id, svgPath, {
|
||||
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||
.isSelected = drawTool->get_type() == toolType,
|
||||
.onClick = [&, toolType] {
|
||||
|
|
@ -367,7 +369,7 @@ void DrawingProgram::toolbar_gui() {
|
|||
tool_button("Pan Canvas Toolbar Button", "data/icons/hand.svg", DrawingProgramToolType::PAN);
|
||||
|
||||
std::shared_ptr<double> oldRotationAngle = std::make_shared<double>(world.drawData.cam.c.rotation);
|
||||
t.gui.element<RotateWheel>("Canvas Rotate Wheel", &world.drawData.cam.c.rotation, [&, oldRotationAngle] {
|
||||
gui.element<RotateWheel>("Canvas Rotate Wheel", &world.drawData.cam.c.rotation, [&, oldRotationAngle] {
|
||||
world.drawData.cam.c.rotate_about(world.drawData.cam.c.from_space(world.main.window.size.cast<float>() * 0.5f), world.drawData.cam.c.rotation - *oldRotationAngle);
|
||||
*oldRotationAngle = world.drawData.cam.c.rotation;
|
||||
});
|
||||
|
|
@ -377,7 +379,9 @@ void DrawingProgram::toolbar_gui() {
|
|||
}
|
||||
|
||||
void DrawingProgram::popup_menu_action_button(const char* id, const char* text, const std::function<void()>& onClick) {
|
||||
GUIStuff::ElementHelpers::text_button(world.main.toolbar.gui, id, text, {
|
||||
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||
|
||||
GUIStuff::ElementHelpers::text_button(gui, id, text, {
|
||||
.drawType = GUIStuff::SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||
.wide = true,
|
||||
.onClick = onClick
|
||||
|
|
@ -390,8 +394,11 @@ void DrawingProgram::selection_action_menu(Vector2f popupPos) {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = world.main.toolbar;
|
||||
t.gui.element<PositionAdjustingPopupMenu>("Selection popup menu", popupPos, [&, popupPos] {
|
||||
text_label_light(t.gui, "Selection menu");
|
||||
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||
auto& io = gui.io;
|
||||
|
||||
gui.element<PositionAdjustingPopupMenu>("Selection popup menu", popupPos, [&, popupPos] {
|
||||
text_label_light(gui, "Selection menu");
|
||||
popup_menu_action_button("Paste", "Paste", [&] {
|
||||
selection.deselect_all();
|
||||
selection.paste_clipboard(popupPos * t.final_gui_scale());
|
||||
|
|
@ -423,7 +430,10 @@ void DrawingProgram::selection_action_menu(Vector2f popupPos) {
|
|||
|
||||
void DrawingProgram::right_click_popup_gui(Vector2f popupPos) {
|
||||
Toolbar& t = world.main.toolbar;
|
||||
t.gui.new_id("Drawing Program right click GUI", [&] {
|
||||
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||
auto& io = gui.io;
|
||||
|
||||
gui.new_id("Drawing Program right click GUI", [&] {
|
||||
drawTool->right_click_popup_gui(popupPos);
|
||||
});
|
||||
}
|
||||
|
|
@ -432,18 +442,21 @@ void DrawingProgram::tool_options_gui() {
|
|||
using namespace GUIStuff;
|
||||
|
||||
Toolbar& t = world.main.toolbar;
|
||||
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||
auto& io = gui.io;
|
||||
|
||||
float minGUIWidth = drawTool->get_type() == DrawingProgramToolType::SCREENSHOT ? 300 : 200;
|
||||
t.gui.element<LayoutElement>("Drawing program tool options gui", [&] {
|
||||
gui.element<LayoutElement>("Drawing program tool options gui", [&] {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(minGUIWidth), .height = CLAY_SIZING_FIT(0)},
|
||||
.padding = CLAY_PADDING_ALL(t.io->theme->padding1),
|
||||
.childGap = t.io->theme->childGap1,
|
||||
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
||||
.childGap = io.theme->childGap1,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(t.io->theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(t.io->theme->windowCorners1)
|
||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
||||
}) {
|
||||
drawTool->gui_toolbox();
|
||||
}
|
||||
|
|
@ -514,7 +527,7 @@ void DrawingProgram::switch_to_tool_ptr(std::unique_ptr<DrawingProgramToolBase>
|
|||
drawTool->switch_tool(newTool->get_type());
|
||||
drawTool = std::move(newTool);
|
||||
world.main.toolbar.rightClickPopupLocation = std::nullopt;
|
||||
world.main.toolbar.gui.set_to_layout();
|
||||
world.main.g.gui.set_to_layout();
|
||||
}
|
||||
|
||||
void DrawingProgram::switch_to_tool(DrawingProgramToolType newToolType, bool force) {
|
||||
|
|
|
|||
|
|
@ -35,21 +35,22 @@ void DrawingProgramSelection::selection_gui() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
auto& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("general selection gui", [&] {
|
||||
text_label(t.gui, "Select from:");
|
||||
radio_button_selector(t.gui, "layer selector", &drawP.controls.layerSelector, {
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
gui.new_id("general selection gui", [&] {
|
||||
text_label(gui, "Select from:");
|
||||
radio_button_selector(gui, "layer selector", &drawP.controls.layerSelector, {
|
||||
{"Layer being edited", DrawingProgramLayerManager::LayerSelector::LAYER_BEING_EDITED},
|
||||
{"All visible layers", DrawingProgramLayerManager::LayerSelector::ALL_VISIBLE_LAYERS}
|
||||
});
|
||||
if(is_something_selected()) {
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
//if(t.gui.color_button_big("Stroke Color Button", &strokeColorChangeData.newColor, &strokeColorChangeData.newColor == t.colorRight)) {
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
//if(gui.color_button_big("Stroke Color Button", &strokeColorChangeData.newColor, &strokeColorChangeData.newColor == t.colorRight)) {
|
||||
// if(strokeColorChangeData.newColor.w() == 0.0f)
|
||||
// strokeColorChangeData.newColor.w() = 1.0f;
|
||||
// t.color_selector_right(&strokeColorChangeData.newColor == t.colorRight ? nullptr : &strokeColorChangeData.newColor);
|
||||
//}
|
||||
text_label(t.gui, "Stroke Color");
|
||||
text_label(gui, "Stroke Color");
|
||||
});
|
||||
update_selection_stroke_color();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void ToolConfiguration::print_relative_width_fail_message(RelativeWidthFailCode
|
|||
}
|
||||
|
||||
void ToolConfiguration::relative_width_gui(DrawingProgram& drawP, const char* label) {
|
||||
auto& gui = drawP.world.main.toolbar.gui;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& lockedCameraScale = drawP.controls.lockedCameraScale;
|
||||
GUIStuff::ElementHelpers::slider_scalar_field(gui, "relstrokewidth", label, &get_stroke_size_relative_width_ref(drawP.drawTool->get_type()), 3.0f, 40.0f);
|
||||
GUIStuff::ElementHelpers::text_button(gui, "lock brush size", lockedCameraScale.has_value() ? "Unlock Size" : "Lock Size to Zoom", {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void BrushTool::input_mouse_button_on_canvas_callback(const InputManager::MouseB
|
|||
if(drawP.world.main.input.pen.isDown) {
|
||||
penWidth = drawP.world.main.input.pen.pressure;
|
||||
if(penWidth != 0.0f) {
|
||||
float brushMinSize = drawP.world.main.toolbar.tabletOptions.brushMinimumSize;
|
||||
float brushMinSize = drawP.world.main.conf.tabletOptions.brushMinimumSize;
|
||||
penWidth = brushMinSize + penWidth * (1.0f - brushMinSize);
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ void BrushTool::input_pen_axis_callback(const InputManager::PenAxisCallbackArgs&
|
|||
if(axis.axis == SDL_PEN_AXIS_PRESSURE) {
|
||||
penWidth = axis.value;
|
||||
if(penWidth != 0.0f) {
|
||||
float brushMinSize = drawP.world.main.toolbar.tabletOptions.brushMinimumSize;
|
||||
float brushMinSize = drawP.world.main.conf.tabletOptions.brushMinimumSize;
|
||||
penWidth = brushMinSize + penWidth * (1.0f - brushMinSize);
|
||||
}
|
||||
}
|
||||
|
|
@ -172,9 +172,11 @@ void BrushTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("brush tool", [&] {
|
||||
text_label_centered(t.gui, "Brush");
|
||||
checkbox_boolean_field(t.gui, "hasroundcaps", "Round Caps", &drawP.world.main.toolConfig.brush.hasRoundCaps);
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
gui.new_id("brush tool", [&] {
|
||||
text_label_centered(gui, "Brush");
|
||||
checkbox_boolean_field(gui, "hasroundcaps", "Round Caps", &drawP.world.main.toolConfig.brush.hasRoundCaps);
|
||||
drawP.world.main.toolConfig.relative_width_gui(drawP, "Size");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,13 @@ void EditTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
if(objInfoBeingEdited)
|
||||
compEditTool->edit_gui(objInfoBeingEdited);
|
||||
else {
|
||||
t.gui.new_id("edit tool", [&] {
|
||||
text_label_centered(t.gui, "Edit");
|
||||
gui.new_id("edit tool", [&] {
|
||||
text_label_centered(gui, "Edit");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ void BrushEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("edit tool brush", [&] {
|
||||
text_label_centered(t.gui, "Edit Brush Stroke");
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
//if(t.gui.color_button_big("Outline Color", &a.d.color, &a.d.color == t.colorRight))
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("edit tool brush", [&] {
|
||||
text_label_centered(gui, "Edit Brush Stroke");
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
//if(gui.color_button_big("Outline Color", &a.d.color, &a.d.color == t.colorRight))
|
||||
// t.color_selector_right(&a.d.color == t.colorRight ? nullptr : &a.d.color);
|
||||
text_label(t.gui, "Outline Color");
|
||||
text_label(gui, "Outline Color");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,28 +21,29 @@ void EllipseDrawEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
auto& a = static_cast<EllipseCanvasComponent&>(comp->obj->get_comp());
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("edit tool ellipse", [&] {
|
||||
text_label_centered(t.gui, "Edit Ellipse");
|
||||
radio_button_selector(t.gui, "Fill selector", &a.d.fillStrokeMode, {
|
||||
gui.new_id("edit tool ellipse", [&] {
|
||||
text_label_centered(gui, "Edit Ellipse");
|
||||
radio_button_selector(gui, "Fill selector", &a.d.fillStrokeMode, {
|
||||
{"Fill only", 0},
|
||||
{"Outline only", 1},
|
||||
{"Fill and outline", 2}
|
||||
});
|
||||
if(a.d.fillStrokeMode == 0 || a.d.fillStrokeMode == 2) {
|
||||
left_to_right_line_layout(t.gui, [&] {
|
||||
//if(t.gui.color_button_big("Fill Color", &a.d.fillColor, &a.d.fillColor == t.colorRight))
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
//if(gui.color_button_big("Fill Color", &a.d.fillColor, &a.d.fillColor == t.colorRight))
|
||||
// t.color_selector_right(&a.d.fillColor == t.colorRight ? nullptr : &a.d.fillColor);
|
||||
text_label(t.gui, "Fill Color");
|
||||
text_label(gui, "Fill Color");
|
||||
});
|
||||
}
|
||||
if(a.d.fillStrokeMode == 1 || a.d.fillStrokeMode == 2) {
|
||||
slider_scalar_field(t.gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f);
|
||||
left_to_right_line_layout(t.gui, [&] {
|
||||
//if(t.gui.color_button_big("Outline Color", &a.d.strokeColor, &a.d.strokeColor == t.colorRight))
|
||||
slider_scalar_field(gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f);
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
//if(gui.color_button_big("Outline Color", &a.d.strokeColor, &a.d.strokeColor == t.colorRight))
|
||||
// t.color_selector_right(&a.d.strokeColor == t.colorRight ? nullptr : &a.d.strokeColor);
|
||||
text_label(t.gui, "Outline Color");
|
||||
text_label(gui, "Outline Color");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,13 +51,14 @@ void ImageEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
|
||||
ImageCanvasComponent& a = static_cast<ImageCanvasComponent&>(comp->obj->get_comp());
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("edit tool image", [&] {
|
||||
text_label_centered(t.gui, "File Properties");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("edit tool image", [&] {
|
||||
text_label_centered(gui, "File Properties");
|
||||
auto resourceData = drawP.world.netObjMan.get_obj_temporary_ref_from_id<ResourceData>(a.d.imageID);
|
||||
|
||||
if(resourceData) {
|
||||
text_label(t.gui, "Name: " + resourceData->name);
|
||||
text_button(t.gui, "file download", "Download file", {
|
||||
text_label(gui, "Name: " + resourceData->name);
|
||||
text_button(gui, "file download", "Download file", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
|
@ -74,6 +75,6 @@ void ImageEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
});
|
||||
}
|
||||
else
|
||||
text_label_centered(t.gui, "Loading resource...");
|
||||
text_label_centered(gui, "Loading resource...");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,27 +19,28 @@ void RectDrawEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
|
||||
auto& a = static_cast<RectangleCanvasComponent&>(comp->obj->get_comp());
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("edit tool rectangle", [&] {
|
||||
text_label_centered(t.gui, "Edit Rectangle");
|
||||
slider_scalar_field(t.gui, "relradiuswidth", "Corner Radius", &a.d.cornerRadius, 0.0f, 40.0f);
|
||||
radio_button_selector(t.gui, "Fill selector", &a.d.fillStrokeMode, {
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("edit tool rectangle", [&] {
|
||||
text_label_centered(gui, "Edit Rectangle");
|
||||
slider_scalar_field(gui, "relradiuswidth", "Corner Radius", &a.d.cornerRadius, 0.0f, 40.0f);
|
||||
radio_button_selector(gui, "Fill selector", &a.d.fillStrokeMode, {
|
||||
{"Fill only", 0},
|
||||
{"Outline only", 1},
|
||||
{"Fill and outline", 2}
|
||||
});
|
||||
if(a.d.fillStrokeMode == 0 || a.d.fillStrokeMode == 2) {
|
||||
left_to_right_line_layout(t.gui, [&] {
|
||||
//if(t.gui.color_button_big("Fill Color", &a.d.fillColor, &a.d.fillColor == t.colorRight))
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
//if(gui.color_button_big("Fill Color", &a.d.fillColor, &a.d.fillColor == t.colorRight))
|
||||
// t.color_selector_right(&a.d.fillColor == t.colorRight ? nullptr : &a.d.fillColor);
|
||||
text_label(t.gui, "Fill Color");
|
||||
text_label(gui, "Fill Color");
|
||||
});
|
||||
}
|
||||
if(a.d.fillStrokeMode == 1 || a.d.fillStrokeMode == 2) {
|
||||
slider_scalar_field(t.gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f);
|
||||
left_to_right_line_layout(t.gui, [&] {
|
||||
//if(t.gui.color_button_big("Outline Color", &a.d.strokeColor, &a.d.strokeColor == t.colorRight))
|
||||
slider_scalar_field(gui, "relstrokewidth", "Outline Size", &a.d.strokeWidth, 3.0f, 40.0f);
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
//if(gui.color_button_big("Outline Color", &a.d.strokeColor, &a.d.strokeColor == t.colorRight))
|
||||
// t.color_selector_right(&a.d.strokeColor == t.colorRight ? nullptr : &a.d.strokeColor);
|
||||
text_label(t.gui, "Outline Color");
|
||||
text_label(gui, "Outline Color");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,43 +30,44 @@ void TextBoxEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
|
||||
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
auto& currentMods = *currentModsPtr;
|
||||
|
||||
t.gui.new_id("edit tool text", [&] {
|
||||
text_label_centered(t.gui, "Edit Text");
|
||||
gui.new_id("edit tool text", [&] {
|
||||
text_label_centered(gui, "Edit Text");
|
||||
|
||||
left_to_right_line_layout(t.gui, [&] {
|
||||
text_label(t.gui, "Font");
|
||||
//if(t.gui.font_picker("font picker", &newFontName)) {
|
||||
left_to_right_line_layout(gui, [&] {
|
||||
text_label(gui, "Font");
|
||||
//if(gui.font_picker("font picker", &newFontName)) {
|
||||
// currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES] = std::make_shared<FontFamiliesTextStyleModifier>(std::vector<SkString>{SkString{newFontName.c_str(), newFontName.size()}});
|
||||
// add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::FONT_FAMILIES]);});
|
||||
//}
|
||||
});
|
||||
|
||||
//left_to_right_line_centered_layout(t.gui, [&] {
|
||||
//left_to_right_line_centered_layout(gui, [&] {
|
||||
// if(svg_icon_button("Bold button", "data/icons/RemixIcon/bold.svg", newIsBold)) {
|
||||
// newIsBold = !newIsBold;
|
||||
// currentMods[TextStyleModifier::ModifierType::WEIGHT] = std::make_shared<WeightTextStyleModifier>(newIsBold ? SkFontStyle::Weight::kBold_Weight : SkFontStyle::Weight::kNormal_Weight);
|
||||
// add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::WEIGHT]);});
|
||||
// }
|
||||
|
||||
// if(t.gui.svg_icon_button("Italic button", "data/icons/RemixIcon/italic.svg", newIsItalic)) {
|
||||
// if(gui.svg_icon_button("Italic button", "data/icons/RemixIcon/italic.svg", newIsItalic)) {
|
||||
// newIsItalic = !newIsItalic;
|
||||
// currentMods[TextStyleModifier::ModifierType::SLANT] = std::make_shared<SlantTextStyleModifier>(newIsItalic ? SkFontStyle::Slant::kItalic_Slant : SkFontStyle::Slant::kUpright_Slant);
|
||||
// add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SLANT]);});
|
||||
// }
|
||||
|
||||
// bool decorationEdited = false;
|
||||
// if(t.gui.svg_icon_button("Underline button", "data/icons/RemixIcon/underline.svg", newIsUnderlined)) {
|
||||
// if(gui.svg_icon_button("Underline button", "data/icons/RemixIcon/underline.svg", newIsUnderlined)) {
|
||||
// newIsUnderlined = !newIsUnderlined;
|
||||
// decorationEdited = true;
|
||||
// }
|
||||
// if(t.gui.svg_icon_button("Strikethrough button", "data/icons/RemixIcon/strikethrough.svg", newIsLinethrough)) {
|
||||
// if(gui.svg_icon_button("Strikethrough button", "data/icons/RemixIcon/strikethrough.svg", newIsLinethrough)) {
|
||||
// newIsLinethrough = !newIsLinethrough;
|
||||
// decorationEdited = true;
|
||||
// }
|
||||
// if(t.gui.svg_icon_button("Overline button", "data/icons/RemixIcon/overline.svg", newIsOverline)) {
|
||||
// if(gui.svg_icon_button("Overline button", "data/icons/RemixIcon/overline.svg", newIsOverline)) {
|
||||
// newIsOverline = !newIsOverline;
|
||||
// decorationEdited = true;
|
||||
// }
|
||||
|
|
@ -76,22 +77,22 @@ void TextBoxEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
// }
|
||||
//});
|
||||
|
||||
//t.gui.left_to_right_line_centered_layout([&]() {
|
||||
// if(t.gui.svg_icon_button("Align left button", "data/icons/RemixIcon/align-left.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kLeft))
|
||||
//gui.left_to_right_line_centered_layout([&]() {
|
||||
// if(gui.svg_icon_button("Align left button", "data/icons/RemixIcon/align-left.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kLeft))
|
||||
// add_undo([&](){a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kLeft);});
|
||||
// if(t.gui.svg_icon_button("Align center button", "data/icons/RemixIcon/align-center.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kCenter))
|
||||
// if(gui.svg_icon_button("Align center button", "data/icons/RemixIcon/align-center.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kCenter))
|
||||
// add_undo([&](){a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kCenter);});
|
||||
// if(t.gui.svg_icon_button("Align right button", "data/icons/RemixIcon/align-right.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kRight))
|
||||
// if(gui.svg_icon_button("Align right button", "data/icons/RemixIcon/align-right.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kRight))
|
||||
// add_undo([&](){a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kRight);});
|
||||
// if(t.gui.svg_icon_button("Align justify button", "data/icons/RemixIcon/align-justify.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kJustify))
|
||||
// if(gui.svg_icon_button("Align justify button", "data/icons/RemixIcon/align-justify.svg", currentPStyle.textAlignment == skia::textlayout::TextAlign::kJustify))
|
||||
// add_undo([&](){a.textBox->set_text_alignment_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextAlign::kJustify);});
|
||||
// if(t.gui.svg_icon_button("Text direction left", "data/icons/RemixIcon/text-direction-l.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kLtr))
|
||||
// if(gui.svg_icon_button("Text direction left", "data/icons/RemixIcon/text-direction-l.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kLtr))
|
||||
// add_undo([&](){a.textBox->set_text_direction_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextDirection::kLtr);});
|
||||
// if(t.gui.svg_icon_button("Text direction right", "data/icons/RemixIcon/text-direction-r.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kRtl))
|
||||
// if(gui.svg_icon_button("Text direction right", "data/icons/RemixIcon/text-direction-r.svg", currentPStyle.textDirection == skia::textlayout::TextDirection::kRtl))
|
||||
// add_undo([&](){a.textBox->set_text_direction_between(a.cursor->selectionBeginPos.fParagraphIndex, a.cursor->selectionEndPos.fParagraphIndex, skia::textlayout::TextDirection::kRtl);});
|
||||
//});
|
||||
|
||||
//if(t.gui.slider_scalar_field<uint32_t>("Font Size Slider", "Font Size", &newFontSize, 3, 100)) {
|
||||
//if(gui.slider_scalar_field<uint32_t>("Font Size Slider", "Font Size", &newFontSize, 3, 100)) {
|
||||
// hold_undo_data("Font Size", a);
|
||||
// currentMods[TextStyleModifier::ModifierType::SIZE] = std::make_shared<SizeTextStyleModifier>(newFontSize);
|
||||
// a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::SIZE]);
|
||||
|
|
@ -100,10 +101,10 @@ void TextBoxEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
// release_undo_data("Font Size");
|
||||
|
||||
//// Text color
|
||||
//t.gui.left_to_right_line_layout([&]() {
|
||||
// if(t.gui.color_button_big("Text Color", &newTextColor, &newTextColor == t.colorRight))
|
||||
//gui.left_to_right_line_layout([&]() {
|
||||
// if(gui.color_button_big("Text Color", &newTextColor, &newTextColor == t.colorRight))
|
||||
// t.color_selector_right(&newTextColor == t.colorRight ? nullptr : &newTextColor);
|
||||
// t.gui.text_label("Text Color");
|
||||
// gui.text_label("Text Color");
|
||||
//});
|
||||
|
||||
//if(&newTextColor == t.colorRight)
|
||||
|
|
@ -119,8 +120,8 @@ void TextBoxEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
|
||||
|
||||
//// Highlight color
|
||||
//t.gui.left_to_right_line_layout([&]() {
|
||||
// if(t.gui.color_button_big("Highlight Color", &newHighlightColor, &newHighlightColor == t.colorRight)) {
|
||||
//gui.left_to_right_line_layout([&]() {
|
||||
// if(gui.color_button_big("Highlight Color", &newHighlightColor, &newHighlightColor == t.colorRight)) {
|
||||
// if(newHighlightColor.w() == 0.0f) { // Make highlight appear when the button is pressed
|
||||
// newHighlightColor.w() = 1.0f;
|
||||
// currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
|
||||
|
|
@ -129,13 +130,13 @@ void TextBoxEditTool::edit_gui(CanvasComponentContainer::ObjInfo* comp) {
|
|||
// t.color_selector_right(&newHighlightColor == t.colorRight ? nullptr : &newHighlightColor);
|
||||
// }
|
||||
// if(newHighlightColor.w() != 0.0f) {
|
||||
// if(t.gui.svg_icon_button("Remove Highlight Color", "data/icons/close.svg")) {
|
||||
// if(gui.svg_icon_button("Remove Highlight Color", "data/icons/close.svg")) {
|
||||
// newHighlightColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
// currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
|
||||
// add_undo_if_selecting_area(a, [&]() {a.textBox->set_text_style_modifier_between(a.cursor->selectionBeginPos, a.cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);});
|
||||
// }
|
||||
// }
|
||||
// t.gui.text_label("Highlight Color");
|
||||
// gui.text_label("Highlight Color");
|
||||
//});
|
||||
|
||||
//if(&newHighlightColor == t.colorRight)
|
||||
|
|
@ -200,10 +201,11 @@ void TextBoxEditTool::right_click_popup_gui(CanvasComponentContainer::ObjInfo* c
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
|
||||
|
||||
t.gui.element<PositionAdjustingPopupMenu>("Text popup menu", popupPos, [&, popupPos] {
|
||||
text_label_light(t.gui, "Text menu");
|
||||
gui.element<PositionAdjustingPopupMenu>("Text popup menu", popupPos, [&, popupPos] {
|
||||
text_label_light(gui, "Text menu");
|
||||
InputManager& input = drawP.world.main.input;
|
||||
drawP.popup_menu_action_button("Paste", "Paste", [&] {
|
||||
input.call_text_paste(true);
|
||||
|
|
|
|||
|
|
@ -25,11 +25,12 @@ void EllipseDrawTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
auto& fillStrokeMode = toolConfig.ellipseDraw.fillStrokeMode;
|
||||
t.gui.new_id("ellipse draw tool", [&] {
|
||||
text_label_centered(t.gui, "Draw Ellipse");
|
||||
radio_button_selector(t.gui, "fill type", &fillStrokeMode, {
|
||||
gui.new_id("ellipse draw tool", [&] {
|
||||
text_label_centered(gui, "Draw Ellipse");
|
||||
radio_button_selector(gui, "fill type", &fillStrokeMode, {
|
||||
{"Fill only", 0},
|
||||
{"Outline only", 1},
|
||||
{"Fill and Outline", 2}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@ void EraserTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("eraser tool", [&] {
|
||||
text_label_centered(t.gui, "Eraser");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("eraser tool", [&] {
|
||||
text_label_centered(gui, "Eraser");
|
||||
drawP.world.main.toolConfig.relative_width_gui(drawP, "Size");
|
||||
text_label(t.gui, "Erase from:");
|
||||
radio_button_selector(t.gui, "layer selector", &drawP.controls.layerSelector, {
|
||||
text_label(gui, "Erase from:");
|
||||
radio_button_selector(gui, "layer selector", &drawP.controls.layerSelector, {
|
||||
{"Layer being edited", DrawingProgramLayerManager::LayerSelector::LAYER_BEING_EDITED},
|
||||
{"All visible layers", DrawingProgramLayerManager::LayerSelector::ALL_VISIBLE_LAYERS}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,11 +31,12 @@ void EyeDropperTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& selectingStrokeColor = drawP.world.main.toolConfig.eyeDropper.selectingStrokeColor;
|
||||
t.gui.new_id("Color select tool", [&] {
|
||||
text_label_centered(t.gui, "Color Select");
|
||||
gui.new_id("Color select tool", [&] {
|
||||
text_label_centered(gui, "Color Select");
|
||||
|
||||
radio_button_selector<bool>(t.gui, "Stroke type", &selectingStrokeColor, {
|
||||
radio_button_selector<bool>(gui, "Stroke type", &selectingStrokeColor, {
|
||||
{"Stroke Color", true},
|
||||
{"Fill Color", false}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -118,14 +118,16 @@ void GridModifyTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("Grid modify tool", [&] {
|
||||
text_label_centered(t.gui, "Edit Grid");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
|
||||
gui.new_id("Grid modify tool", [&] {
|
||||
text_label_centered(gui, "Edit Grid");
|
||||
NetworkingObjects::NetObjTemporaryPtr<WorldGrid> gLock = grid.lock();
|
||||
if(gLock) {
|
||||
WorldGrid& g = *gLock;
|
||||
input_text_field(t.gui, "grid name", "Name", &g.name);
|
||||
checkbox_boolean_field(t.gui, "Visible", "Visible", &g.visible);
|
||||
checkbox_boolean_field(t.gui, "Display in Front", "Display in front of canvas", &g.displayInFront);
|
||||
input_text_field(gui, "grid name", "Name", &g.name);
|
||||
checkbox_boolean_field(gui, "Visible", "Visible", &g.visible);
|
||||
checkbox_boolean_field(gui, "Display in Front", "Display in front of canvas", &g.displayInFront);
|
||||
size_t typeSelected = static_cast<size_t>(g.gridType);
|
||||
std::vector<std::string> listOfGridTypes = {
|
||||
"Circle Points",
|
||||
|
|
@ -133,25 +135,25 @@ void GridModifyTool::gui_toolbox() {
|
|||
"Square Lines",
|
||||
"Horizontal Lines"
|
||||
};
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
text_label(t.gui, "Type");
|
||||
t.gui.element<DropDown<size_t>>("filepicker select type", &typeSelected, listOfGridTypes);
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
text_label(gui, "Type");
|
||||
gui.element<DropDown<size_t>>("filepicker select type", &typeSelected, listOfGridTypes);
|
||||
});
|
||||
g.gridType = static_cast<WorldGrid::GridType>(typeSelected);
|
||||
uint32_t sDiv = g.subdivisions;
|
||||
input_scalar_field<uint32_t>(t.gui, "Subdivisions", "Subdivisions", &sDiv, 1, 10);
|
||||
input_scalar_field<uint32_t>(gui, "Subdivisions", "Subdivisions", &sDiv, 1, 10);
|
||||
g.set_subdivisions(sDiv);
|
||||
bool divOut = g.removeDivisionsOutwards;
|
||||
checkbox_boolean_field(t.gui, "Subdivide outwards", "Subdivide when zooming out", &divOut);
|
||||
checkbox_boolean_field(gui, "Subdivide outwards", "Subdivide when zooming out", &divOut);
|
||||
g.set_remove_divisions_outwards(divOut);
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
//if(t.gui.color_button_big("Grid Color", &g.color, &g.color == t.colorRight))
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
//if(gui.color_button_big("Grid Color", &g.color, &g.color == t.colorRight))
|
||||
// t.color_selector_right(&g.color == t.colorRight ? nullptr : &g.color);
|
||||
text_label(t.gui, "Grid Color");
|
||||
text_label(gui, "Grid Color");
|
||||
});
|
||||
bool bounded = g.bounds.has_value();
|
||||
bool prevBoundedValue = bounded;
|
||||
checkbox_boolean_field(t.gui, "Bounded", "Bounded", &bounded);
|
||||
checkbox_boolean_field(gui, "Bounded", "Bounded", &bounded);
|
||||
if(bounded && !prevBoundedValue) {
|
||||
SCollision::AABB<WorldScalar> newBounds;
|
||||
newBounds.min = g.offset - drawP.world.drawData.cam.c.dir_from_space(drawP.world.main.window.size.cast<float>() * 0.3f);
|
||||
|
|
@ -160,7 +162,7 @@ void GridModifyTool::gui_toolbox() {
|
|||
}
|
||||
else if(!bounded && prevBoundedValue)
|
||||
g.bounds = std::nullopt;
|
||||
checkbox_boolean_field(t.gui, "Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
|
||||
checkbox_boolean_field(gui, "Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@ DrawingProgramToolType LassoSelectTool::get_type() {
|
|||
|
||||
void LassoSelectTool::gui_toolbox() {
|
||||
auto& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("lasso select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(t.gui, "Lasso Select");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("lasso select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Lasso Select");
|
||||
drawP.selection.selection_gui();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,12 @@ void LineDrawTool::gui_toolbox() {
|
|||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
t.gui.new_id("rect draw tool", [&] {
|
||||
text_label_centered(t.gui, "Draw Line");
|
||||
gui.new_id("rect draw tool", [&] {
|
||||
text_label_centered(gui, "Draw Line");
|
||||
toolConfig.relative_width_gui(drawP, "Size");
|
||||
checkbox_boolean_field(t.gui, "hasroundcaps", "Round Caps", &toolConfig.lineDraw.hasRoundCaps);
|
||||
checkbox_boolean_field(gui, "hasroundcaps", "Round Caps", &toolConfig.lineDraw.hasRoundCaps);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ DrawingProgramToolType PanCanvasTool::get_type() {
|
|||
|
||||
void PanCanvasTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("Pan canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(t.gui, "Pan tool");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("Pan canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Pan tool");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ void RectDrawTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& toolConfig = drawP.world.main.toolConfig;
|
||||
auto& fillStrokeMode = toolConfig.rectDraw.fillStrokeMode;
|
||||
auto& relativeRadiusWidth = toolConfig.rectDraw.relativeRadiusWidth;
|
||||
t.gui.new_id("rect draw tool", [&] {
|
||||
text_label_centered(t.gui, "Draw Rectangle");
|
||||
slider_scalar_field(t.gui, "relradiuswidth", "Corner Radius", &relativeRadiusWidth, 0.0f, 40.0f);
|
||||
radio_button_selector(t.gui, "fill type", &fillStrokeMode, {
|
||||
gui.new_id("rect draw tool", [&] {
|
||||
text_label_centered(gui, "Draw Rectangle");
|
||||
slider_scalar_field(gui, "relradiuswidth", "Corner Radius", &relativeRadiusWidth, 0.0f, 40.0f);
|
||||
radio_button_selector(gui, "fill type", &fillStrokeMode, {
|
||||
{"Fill only", 0},
|
||||
{"Outline only", 1},
|
||||
{"Fill and Outline", 2}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ DrawingProgramToolType RectSelectTool::get_type() {
|
|||
|
||||
void RectSelectTool::gui_toolbox() {
|
||||
auto& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("rectangle select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(t.gui, "Rectangle Select");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("rectangle select tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Rectangle Select");
|
||||
drawP.selection.selection_gui();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,25 +57,26 @@ void ScreenshotTool::gui_toolbox() {
|
|||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
auto& screenshotConfig = drawP.world.main.toolConfig.screenshot;
|
||||
t.gui.new_id("screenshot tool", [&] {
|
||||
text_label_centered(t.gui, "Screenshot");
|
||||
gui.new_id("screenshot tool", [&] {
|
||||
text_label_centered(gui, "Screenshot");
|
||||
auto oldImgSize = controls.imageSize;
|
||||
if(controls.selectionMode == ScreenshotControls::SelectionMode::NO_SELECTION)
|
||||
text_label(t.gui, "Select an area on the canvas...");
|
||||
text_label(gui, "Select an area on the canvas...");
|
||||
if(controls.selectionMode != ScreenshotControls::SelectionMode::NO_SELECTION && screenshotConfig.selectedType != SCREENSHOT_SVG)
|
||||
input_scalars_field(t.gui, "Image Size", "Image Size", &controls.imageSize, 2, 0, 999999999);
|
||||
input_scalars_field(gui, "Image Size", "Image Size", &controls.imageSize, 2, 0, 999999999);
|
||||
if(controls.selectionMode == ScreenshotControls::SelectionMode::SELECTION_EXISTS) {
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
text_label(t.gui, "Image Type");
|
||||
t.gui.element<DropDown<size_t>>("image type select", (size_t*)(&screenshotConfig.selectedType), controls.typeSelections);
|
||||
left_to_right_line_layout(gui, [&]() {
|
||||
text_label(gui, "Image Type");
|
||||
gui.element<DropDown<size_t>>("image type select", (size_t*)(&screenshotConfig.selectedType), controls.typeSelections);
|
||||
});
|
||||
if(screenshotConfig.selectedType != SCREENSHOT_SVG)
|
||||
checkbox_boolean_field(t.gui, "Display Grid", "Display Grid", &controls.displayGrid);
|
||||
checkbox_boolean_field(gui, "Display Grid", "Display Grid", &controls.displayGrid);
|
||||
else
|
||||
text_label(t.gui, "Note: Screenshot will ignore blend\nmodes and layer alpha");
|
||||
text_label(gui, "Note: Screenshot will ignore blend\nmodes and layer alpha");
|
||||
if(screenshotConfig.selectedType != 0)
|
||||
checkbox_boolean_field(t.gui, "Transparent Background", "Transparent Background", &controls.transparentBackground);
|
||||
checkbox_boolean_field(gui, "Transparent Background", "Transparent Background", &controls.transparentBackground);
|
||||
if(controls.imageSize.x() != oldImgSize.x()) {
|
||||
screenshotConfig.setDimensionSize = controls.imageSize.x();
|
||||
screenshotConfig.setDimensionIsX = true;
|
||||
|
|
@ -86,7 +87,7 @@ void ScreenshotTool::gui_toolbox() {
|
|||
screenshotConfig.setDimensionIsX = false;
|
||||
controls.imageSize.x() = controls.imageSize.y() * (controls.rectX2 - controls.rectX1) / (controls.rectY2 - controls.rectY1);
|
||||
}
|
||||
text_button(t.gui, "Take Screenshot", "Take Screenshot", {
|
||||
text_button(gui, "Take Screenshot", "Take Screenshot", {
|
||||
.wide = true,
|
||||
.onClick = [&] {
|
||||
controls.selectionMode = ScreenshotControls::SelectionMode::NO_SELECTION;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ DrawingProgramToolType TextBoxTool::get_type() {
|
|||
|
||||
void TextBoxTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("textbox tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(t.gui, "Zoom tool");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("textbox tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Zoom tool");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ DrawingProgramToolType ZoomCanvasTool::get_type() {
|
|||
|
||||
void ZoomCanvasTool::gui_toolbox() {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.new_id("Zoom canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(t.gui, "Zoom tool");
|
||||
auto& gui = drawP.world.main.g.gui;
|
||||
gui.new_id("Zoom canvas tool", [&] {
|
||||
GUIStuff::ElementHelpers::text_label_centered(gui, "Zoom tool");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue