本文整理汇总了C++中IDocumentSettings::setGridColor方法的典型用法代码示例。如果您正苦于以下问题:C++ IDocumentSettings::setGridColor方法的具体用法?C++ IDocumentSettings::setGridColor怎么用?C++ IDocumentSettings::setGridColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocumentSettings
的用法示例。
在下文中一共展示了IDocumentSettings::setGridColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onExecute
void OptionsCommand::onExecute(Context* context)
{
// Load the window widget
UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
Widget* cursor_color_box = app::find_widget<Widget>(window, "cursor_color_box");
Widget* grid_color_box = app::find_widget<Widget>(window, "grid_color_box");
Widget* pixel_grid_color_box = app::find_widget<Widget>(window, "pixel_grid_color_box");
m_checked_bg = app::find_widget<ComboBox>(window, "checked_bg_size");
m_checked_bg_zoom = app::find_widget<Widget>(window, "checked_bg_zoom");
Widget* checked_bg_color1_box = app::find_widget<Widget>(window, "checked_bg_color1_box");
Widget* checked_bg_color2_box = app::find_widget<Widget>(window, "checked_bg_color2_box");
Button* checked_bg_reset = app::find_widget<Button>(window, "checked_bg_reset");
Widget* undo_size_limit = app::find_widget<Widget>(window, "undo_size_limit");
Widget* undo_goto_modified = app::find_widget<Widget>(window, "undo_goto_modified");
Widget* button_ok = app::find_widget<Widget>(window, "button_ok");
// Cursor color
ColorButton* cursor_color = new ColorButton(Editor::get_cursor_color(), IMAGE_RGB);
cursor_color->setId("cursor_color");
cursor_color_box->addChild(cursor_color);
// Get global settings for documents
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(NULL);
// Grid color
ColorButton* grid_color = new ColorButton(docSettings->getGridColor(), IMAGE_RGB);
grid_color->setId("grid_color");
grid_color_box->addChild(grid_color);
// Pixel grid color
ColorButton* pixel_grid_color = new ColorButton(docSettings->getPixelGridColor(), IMAGE_RGB);
pixel_grid_color->setId("pixel_grid_color");
pixel_grid_color_box->addChild(pixel_grid_color);
// Others
if (get_config_bool("Options", "MoveClick2", false))
move_click2->setSelected(true);
if (get_config_bool("Options", "DrawClick2", false))
draw_click2->setSelected(true);
if (get_config_bool("Options", "MoveSmooth", true))
check_smooth->setSelected(true);
// Checked background size
m_checked_bg->addItem("16x16");
m_checked_bg->addItem("8x8");
m_checked_bg->addItem("4x4");
m_checked_bg->addItem("2x2");
m_checked_bg->setSelectedItem((int)RenderEngine::getCheckedBgType());
// Zoom checked background
if (RenderEngine::getCheckedBgZoom())
m_checked_bg_zoom->setSelected(true);
// Checked background colors
m_checked_bg_color1 = new ColorButton(RenderEngine::getCheckedBgColor1(), IMAGE_RGB);
m_checked_bg_color2 = new ColorButton(RenderEngine::getCheckedBgColor2(), IMAGE_RGB);
checked_bg_color1_box->addChild(m_checked_bg_color1);
checked_bg_color2_box->addChild(m_checked_bg_color2);
// Reset button
checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));
// Undo limit
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
// Goto modified frame/layer on undo/redo
if (get_config_bool("Options", "UndoGotoModified", true))
undo_goto_modified->setSelected(true);
// Show the window and wait the user to close it
window->openWindowInForeground();
if (window->getKiller() == button_ok) {
int undo_size_limit_value;
Editor::set_cursor_color(cursor_color->getColor());
docSettings->setGridColor(grid_color->getColor());
docSettings->setPixelGridColor(pixel_grid_color->getColor());
set_config_bool("Options", "MoveSmooth", check_smooth->isSelected());
set_config_bool("Options", "MoveClick2", move_click2->isSelected());
set_config_bool("Options", "DrawClick2", draw_click2->isSelected());
RenderEngine::setCheckedBgType((RenderEngine::CheckedBgType)m_checked_bg->getSelectedItem());
RenderEngine::setCheckedBgZoom(m_checked_bg_zoom->isSelected());
RenderEngine::setCheckedBgColor1(m_checked_bg_color1->getColor());
RenderEngine::setCheckedBgColor2(m_checked_bg_color2->getColor());
undo_size_limit_value = undo_size_limit->getTextInt();
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
set_config_bool("Options", "UndoGotoModified", undo_goto_modified->isSelected());
// Save configuration
//.........这里部分代码省略.........