2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
|
|
|
// Copyright (C) 2001-2015 David Capello
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2 as
|
|
|
|
// published by the Free Software Foundation.
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-01-06 06:45:03 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/app.h"
|
|
|
|
#include "app/commands/command.h"
|
|
|
|
#include "app/context.h"
|
2012-06-16 10:37:59 +08:00
|
|
|
#include "app/find_widget.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/ini_file.h"
|
2014-06-14 10:00:49 +08:00
|
|
|
#include "app/launcher.h"
|
2012-06-16 10:37:59 +08:00
|
|
|
#include "app/load_widget.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/modules/editors.h"
|
2014-02-08 11:19:20 +08:00
|
|
|
#include "app/modules/gui.h"
|
2014-12-15 07:19:31 +08:00
|
|
|
#include "app/pref/preferences.h"
|
2014-08-20 11:11:19 +08:00
|
|
|
#include "app/resource_finder.h"
|
2014-08-24 11:19:14 +08:00
|
|
|
#include "app/send_crash.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/settings/settings.h"
|
|
|
|
#include "app/ui/color_button.h"
|
|
|
|
#include "app/ui/editor/editor.h"
|
2012-06-16 10:37:59 +08:00
|
|
|
#include "base/bind.h"
|
2015-04-09 18:46:55 +08:00
|
|
|
#include "base/convert_to.h"
|
2014-08-24 11:19:14 +08:00
|
|
|
#include "base/path.h"
|
2014-10-21 09:21:31 +08:00
|
|
|
#include "doc/image.h"
|
2014-12-28 22:06:11 +08:00
|
|
|
#include "render/render.h"
|
2014-08-11 06:51:14 +08:00
|
|
|
#include "she/system.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "ui/ui.h"
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-08-10 12:12:31 +08:00
|
|
|
#include "generated_options.h"
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
2012-06-18 09:02:54 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
using namespace ui;
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-08-10 12:12:31 +08:00
|
|
|
class OptionsWindow : public app::gen::Options {
|
2012-01-06 06:45:03 +08:00
|
|
|
public:
|
2015-02-15 09:43:21 +08:00
|
|
|
OptionsWindow(Context* context, int& curSection)
|
2014-08-10 12:12:31 +08:00
|
|
|
: m_settings(context->settings())
|
2014-12-28 22:06:11 +08:00
|
|
|
, m_preferences(App::instance()->preferences())
|
2015-02-15 10:31:11 +08:00
|
|
|
, m_globPref(m_preferences.document(nullptr))
|
2014-12-28 22:06:11 +08:00
|
|
|
, m_docPref(m_preferences.document(context->activeDocument()))
|
2015-02-15 10:31:11 +08:00
|
|
|
, m_curPref(&m_docPref)
|
|
|
|
, m_checked_bg_color1(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
|
|
|
, m_checked_bg_color2(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
|
|
|
, m_pixelGridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
|
|
|
, m_gridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
2014-06-23 08:56:04 +08:00
|
|
|
, m_cursorColor(new ColorButton(Editor::get_cursor_color(), IMAGE_RGB))
|
2015-02-15 09:43:21 +08:00
|
|
|
, m_curSection(curSection)
|
2014-06-23 08:56:04 +08:00
|
|
|
{
|
2014-08-10 12:12:31 +08:00
|
|
|
sectionListbox()->ChangeSelectedItem.connect(Bind<void>(&OptionsWindow::onChangeSection, this));
|
|
|
|
cursorColorBox()->addChild(m_cursorColor);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
// Grid color
|
|
|
|
m_gridColor->setId("grid_color");
|
2014-11-25 06:13:25 +08:00
|
|
|
gridColorPlaceholder()->addChild(m_gridColor);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
// Pixel grid color
|
|
|
|
m_pixelGridColor->setId("pixel_grid_color");
|
2014-11-25 06:13:25 +08:00
|
|
|
pixelGridColorPlaceholder()->addChild(m_pixelGridColor);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
// Others
|
2014-12-28 22:06:11 +08:00
|
|
|
if (m_preferences.general.autoshowTimeline())
|
2014-08-10 12:12:31 +08:00
|
|
|
autotimeline()->setSelected(true);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2014-12-28 22:06:11 +08:00
|
|
|
if (m_preferences.general.expandMenubarOnMouseover())
|
2014-10-25 22:24:29 +08:00
|
|
|
expandMenubarOnMouseover()->setSelected(true);
|
|
|
|
|
2015-04-09 07:28:30 +08:00
|
|
|
if (m_preferences.general.dataRecovery())
|
|
|
|
enableDataRecovery()->setSelected(true);
|
|
|
|
|
2015-04-09 18:46:55 +08:00
|
|
|
dataRecoveryPeriod()->setSelectedItemIndex(
|
|
|
|
dataRecoveryPeriod()->findItemIndexByValue(
|
|
|
|
base::convert_to<std::string>(m_preferences.general.dataRecoveryPeriod())));
|
|
|
|
|
2015-05-08 02:52:26 +08:00
|
|
|
if (m_preferences.editor.zoomFromCenterWithWheel())
|
|
|
|
zoomFromCenterWithWheel()->setSelected(true);
|
2014-11-08 06:11:23 +08:00
|
|
|
|
2015-05-08 02:56:38 +08:00
|
|
|
if (m_preferences.editor.zoomFromCenterWithKeys())
|
|
|
|
zoomFromCenterWithKeys()->setSelected(true);
|
|
|
|
|
2015-03-03 03:07:35 +08:00
|
|
|
if (m_preferences.experimental.useNativeCursor())
|
2014-08-11 06:51:14 +08:00
|
|
|
nativeCursor()->setSelected(true);
|
|
|
|
|
2015-03-03 03:07:35 +08:00
|
|
|
if (m_preferences.experimental.useNativeFileDialog())
|
|
|
|
nativeFileDialog()->setSelected(true);
|
|
|
|
|
|
|
|
if (m_preferences.experimental.flashLayer())
|
2014-10-26 03:04:39 +08:00
|
|
|
flashLayer()->setSelected(true);
|
|
|
|
|
2015-05-13 21:41:55 +08:00
|
|
|
if (m_preferences.editor.showScrollbars())
|
2014-08-10 12:12:31 +08:00
|
|
|
showScrollbars()->setSelected(true);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2015-02-15 10:31:11 +08:00
|
|
|
// Scope
|
|
|
|
gridScope()->addItem("Global");
|
|
|
|
if (context->activeDocument()) {
|
|
|
|
gridScope()->addItem("Current Document");
|
|
|
|
gridScope()->setSelectedItemIndex(1);
|
|
|
|
gridScope()->Change.connect(Bind<void>(&OptionsWindow::onChangeGridScope, this));
|
|
|
|
}
|
|
|
|
|
2015-04-17 22:11:36 +08:00
|
|
|
// Screen/UI Scale
|
|
|
|
screenScale()->setSelectedItemIndex(
|
|
|
|
screenScale()->findItemIndexByValue(
|
|
|
|
base::convert_to<std::string>(m_preferences.general.screenScale())));
|
|
|
|
|
|
|
|
uiScale()->setSelectedItemIndex(
|
|
|
|
uiScale()->findItemIndexByValue(
|
2015-04-17 23:24:33 +08:00
|
|
|
base::convert_to<std::string>(m_preferences.experimental.uiScale())));
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2014-08-19 19:17:57 +08:00
|
|
|
// Right-click
|
|
|
|
rightClickBehavior()->addItem("Paint with background color");
|
|
|
|
rightClickBehavior()->addItem("Pick foreground color");
|
|
|
|
rightClickBehavior()->addItem("Erase");
|
2015-05-13 22:19:16 +08:00
|
|
|
rightClickBehavior()->setSelectedItemIndex((int)m_preferences.editor.rightClickMode());
|
2014-08-19 19:17:57 +08:00
|
|
|
|
2014-06-23 09:35:51 +08:00
|
|
|
// Zoom with Scroll Wheel
|
2015-05-13 21:33:05 +08:00
|
|
|
wheelZoom()->setSelected(m_preferences.editor.zoomWithWheel());
|
2014-06-23 09:35:51 +08:00
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
// Checked background size
|
2014-08-10 12:12:31 +08:00
|
|
|
checkedBgSize()->addItem("16x16");
|
|
|
|
checkedBgSize()->addItem("8x8");
|
|
|
|
checkedBgSize()->addItem("4x4");
|
|
|
|
checkedBgSize()->addItem("2x2");
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
// Checked background colors
|
2014-08-10 12:12:31 +08:00
|
|
|
checkedBgColor1Box()->addChild(m_checked_bg_color1);
|
|
|
|
checkedBgColor2Box()->addChild(m_checked_bg_color2);
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
// Reset button
|
2014-11-25 06:13:25 +08:00
|
|
|
reset()->Click.connect(Bind<void>(&OptionsWindow::onReset, this));
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2014-08-20 11:11:19 +08:00
|
|
|
// Links
|
2014-08-10 12:12:31 +08:00
|
|
|
locateFile()->Click.connect(Bind<void>(&OptionsWindow::onLocateConfigFile, this));
|
2015-02-12 23:46:56 +08:00
|
|
|
#if _WIN32
|
2014-08-20 11:11:19 +08:00
|
|
|
locateCrashFolder()->Click.connect(Bind<void>(&OptionsWindow::onLocateCrashFolder, this));
|
|
|
|
#else
|
|
|
|
locateCrashFolder()->setVisible(false);
|
|
|
|
#endif
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2015-01-19 09:05:33 +08:00
|
|
|
// Undo preferences
|
|
|
|
undoSizeLimit()->setTextf("%d", m_preferences.undo.sizeLimit());
|
|
|
|
undoGotoModified()->setSelected(m_preferences.undo.gotoModified());
|
|
|
|
undoAllowNonlinearHistory()->setSelected(m_preferences.undo.allowNonlinearHistory());
|
2014-06-23 08:56:04 +08:00
|
|
|
|
2015-02-15 10:31:11 +08:00
|
|
|
onChangeGridScope();
|
2015-02-15 09:43:21 +08:00
|
|
|
sectionListbox()->selectIndex(m_curSection);
|
2014-06-23 08:56:04 +08:00
|
|
|
}
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
bool ok() {
|
2014-08-10 12:12:31 +08:00
|
|
|
return (getKiller() == buttonOk());
|
2014-06-23 08:56:04 +08:00
|
|
|
}
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
void saveConfig() {
|
|
|
|
Editor::set_cursor_color(m_cursorColor->getColor());
|
2014-12-28 22:06:11 +08:00
|
|
|
m_preferences.general.autoshowTimeline(autotimeline()->isSelected());
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-10-25 22:24:29 +08:00
|
|
|
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
2014-12-28 22:06:11 +08:00
|
|
|
m_preferences.general.expandMenubarOnMouseover(expandOnMouseover);
|
2014-10-25 22:24:29 +08:00
|
|
|
ui::MenuBar::setExpandOnMouseover(expandOnMouseover);
|
|
|
|
|
2015-04-09 07:28:30 +08:00
|
|
|
std::string warnings;
|
|
|
|
|
2015-04-09 18:46:55 +08:00
|
|
|
int newPeriod = base::convert_to<int>(dataRecoveryPeriod()->getValue());
|
|
|
|
if (enableDataRecovery()->isSelected() != m_preferences.general.dataRecovery() ||
|
|
|
|
newPeriod != m_preferences.general.dataRecoveryPeriod()) {
|
2015-04-09 07:28:30 +08:00
|
|
|
m_preferences.general.dataRecovery(enableDataRecovery()->isSelected());
|
2015-04-09 18:46:55 +08:00
|
|
|
m_preferences.general.dataRecoveryPeriod(newPeriod);
|
|
|
|
|
|
|
|
warnings += "<<- Automatically save recovery data every";
|
2015-04-09 07:28:30 +08:00
|
|
|
}
|
|
|
|
|
2015-05-08 02:52:26 +08:00
|
|
|
m_preferences.editor.zoomFromCenterWithWheel(zoomFromCenterWithWheel()->isSelected());
|
2015-05-08 02:56:38 +08:00
|
|
|
m_preferences.editor.zoomFromCenterWithKeys(zoomFromCenterWithKeys()->isSelected());
|
2015-05-13 21:41:55 +08:00
|
|
|
m_preferences.editor.showScrollbars(showScrollbars()->isSelected());
|
2015-05-13 21:33:05 +08:00
|
|
|
m_preferences.editor.zoomWithWheel(wheelZoom()->isSelected());
|
2015-05-13 22:19:16 +08:00
|
|
|
m_preferences.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
2014-01-27 00:28:11 +08:00
|
|
|
|
2015-02-15 20:48:38 +08:00
|
|
|
m_curPref->grid.color(m_gridColor->getColor());
|
|
|
|
m_curPref->grid.opacity(gridOpacity()->getValue());
|
|
|
|
m_curPref->grid.autoOpacity(gridAutoOpacity()->isSelected());
|
|
|
|
m_curPref->pixelGrid.color(m_pixelGridColor->getColor());
|
|
|
|
m_curPref->pixelGrid.opacity(pixelGridOpacity()->getValue());
|
|
|
|
m_curPref->pixelGrid.autoOpacity(pixelGridAutoOpacity()->isSelected());
|
2015-02-15 10:31:11 +08:00
|
|
|
m_curPref->bg.type(app::gen::BgType(checkedBgSize()->getSelectedItemIndex()));
|
|
|
|
m_curPref->bg.zoom(checkedBgZoom()->isSelected());
|
|
|
|
m_curPref->bg.color1(m_checked_bg_color1->getColor());
|
|
|
|
m_curPref->bg.color2(m_checked_bg_color2->getColor());
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
int undo_size_limit_value;
|
2014-08-10 12:12:31 +08:00
|
|
|
undo_size_limit_value = undoSizeLimit()->getTextInt();
|
2012-01-06 06:45:03 +08:00
|
|
|
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
|
2014-07-31 11:19:58 +08:00
|
|
|
|
2015-01-19 09:05:33 +08:00
|
|
|
m_preferences.undo.sizeLimit(undo_size_limit_value);
|
|
|
|
m_preferences.undo.gotoModified(undoGotoModified()->isSelected());
|
|
|
|
m_preferences.undo.allowNonlinearHistory(undoAllowNonlinearHistory()->isSelected());
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-10-26 03:04:39 +08:00
|
|
|
// Experimental features
|
2015-03-03 03:07:35 +08:00
|
|
|
m_preferences.experimental.useNativeCursor(nativeCursor()->isSelected());
|
|
|
|
m_preferences.experimental.useNativeFileDialog(nativeFileDialog()->isSelected());
|
|
|
|
m_preferences.experimental.flashLayer(flashLayer()->isSelected());
|
|
|
|
ui::set_use_native_cursors(
|
|
|
|
m_preferences.experimental.useNativeCursor());
|
2014-08-11 06:51:14 +08:00
|
|
|
|
2015-04-17 22:11:36 +08:00
|
|
|
bool reset_screen = false;
|
|
|
|
int newScreenScale = base::convert_to<int>(screenScale()->getValue());
|
|
|
|
if (newScreenScale != m_preferences.general.screenScale()) {
|
|
|
|
m_preferences.general.screenScale(newScreenScale);
|
|
|
|
reset_screen = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
int newUIScale = base::convert_to<int>(uiScale()->getValue());
|
2015-04-17 23:24:33 +08:00
|
|
|
if (newUIScale != m_preferences.experimental.uiScale()) {
|
|
|
|
m_preferences.experimental.uiScale(newUIScale);
|
2015-04-17 22:11:36 +08:00
|
|
|
warnings += "<<- UI Elements Scale";
|
2014-02-08 11:19:20 +08:00
|
|
|
}
|
|
|
|
|
2012-01-06 06:45:03 +08:00
|
|
|
// Save configuration
|
|
|
|
flush_config_file();
|
2015-04-09 07:28:30 +08:00
|
|
|
|
|
|
|
if (!warnings.empty()) {
|
|
|
|
ui::Alert::show(PACKAGE
|
|
|
|
"<<You must restart the program to see your changes to:%s"
|
|
|
|
"||&OK", warnings.c_str());
|
|
|
|
}
|
2015-04-17 22:11:36 +08:00
|
|
|
|
|
|
|
if (reset_screen)
|
2015-04-17 23:24:33 +08:00
|
|
|
gui_setup_screen();
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
private:
|
|
|
|
void onChangeSection() {
|
2015-03-02 22:18:33 +08:00
|
|
|
ListItem* item = static_cast<ListItem*>(sectionListbox()->getSelectedChild());
|
2014-06-23 08:56:04 +08:00
|
|
|
if (!item)
|
|
|
|
return;
|
|
|
|
|
2014-08-10 12:12:31 +08:00
|
|
|
panel()->showChild(findChild(item->getValue().c_str()));
|
2015-02-15 09:43:21 +08:00
|
|
|
m_curSection = sectionListbox()->getSelectedIndex();
|
2014-06-23 08:56:04 +08:00
|
|
|
}
|
|
|
|
|
2015-02-15 10:31:11 +08:00
|
|
|
void onChangeGridScope() {
|
|
|
|
int item = gridScope()->getSelectedItemIndex();
|
|
|
|
|
|
|
|
switch (item) {
|
2015-02-15 20:48:38 +08:00
|
|
|
case 0: m_curPref = &m_globPref; break;
|
|
|
|
case 1: m_curPref = &m_docPref; break;
|
2015-02-15 10:31:11 +08:00
|
|
|
}
|
|
|
|
|
2015-02-15 20:48:38 +08:00
|
|
|
m_gridColor->setColor(m_curPref->grid.color());
|
|
|
|
gridOpacity()->setValue(m_curPref->grid.opacity());
|
|
|
|
gridAutoOpacity()->setSelected(m_curPref->grid.autoOpacity());
|
2015-02-15 10:31:11 +08:00
|
|
|
|
2015-02-15 20:48:38 +08:00
|
|
|
m_pixelGridColor->setColor(m_curPref->pixelGrid.color());
|
|
|
|
pixelGridOpacity()->setValue(m_curPref->pixelGrid.opacity());
|
|
|
|
pixelGridAutoOpacity()->setSelected(m_curPref->pixelGrid.autoOpacity());
|
2015-02-15 10:31:11 +08:00
|
|
|
|
|
|
|
checkedBgSize()->setSelectedItemIndex(int(m_curPref->bg.type()));
|
|
|
|
checkedBgZoom()->setSelected(m_curPref->bg.zoom());
|
|
|
|
m_checked_bg_color1->setColor(m_curPref->bg.color1());
|
|
|
|
m_checked_bg_color2->setColor(m_curPref->bg.color2());
|
|
|
|
}
|
|
|
|
|
2014-11-25 06:13:25 +08:00
|
|
|
void onReset() {
|
2015-02-15 20:59:11 +08:00
|
|
|
// Reset global settings (use default values specified in pref.xml)
|
|
|
|
if (m_curPref == &m_globPref) {
|
|
|
|
DocumentPreferences& pref = m_globPref;
|
|
|
|
|
|
|
|
m_gridColor->setColor(pref.grid.color.defaultValue());
|
|
|
|
gridOpacity()->setValue(pref.grid.opacity.defaultValue());
|
|
|
|
gridAutoOpacity()->setSelected(pref.grid.autoOpacity.defaultValue());
|
|
|
|
|
|
|
|
m_pixelGridColor->setColor(pref.pixelGrid.color.defaultValue());
|
|
|
|
pixelGridOpacity()->setValue(pref.pixelGrid.opacity.defaultValue());
|
|
|
|
pixelGridAutoOpacity()->setSelected(pref.pixelGrid.autoOpacity.defaultValue());
|
|
|
|
|
|
|
|
checkedBgSize()->setSelectedItemIndex(int(pref.bg.type.defaultValue()));
|
|
|
|
checkedBgZoom()->setSelected(pref.bg.zoom.defaultValue());
|
|
|
|
m_checked_bg_color1->setColor(pref.bg.color1.defaultValue());
|
|
|
|
m_checked_bg_color2->setColor(pref.bg.color2.defaultValue());
|
|
|
|
}
|
|
|
|
// Reset document settings with global settings
|
|
|
|
else {
|
|
|
|
DocumentPreferences& pref = m_globPref;
|
|
|
|
|
|
|
|
m_gridColor->setColor(pref.grid.color());
|
|
|
|
gridOpacity()->setValue(pref.grid.opacity());
|
|
|
|
gridAutoOpacity()->setSelected(pref.grid.autoOpacity());
|
|
|
|
|
|
|
|
m_pixelGridColor->setColor(pref.pixelGrid.color());
|
|
|
|
pixelGridOpacity()->setValue(pref.pixelGrid.opacity());
|
|
|
|
pixelGridAutoOpacity()->setSelected(pref.pixelGrid.autoOpacity());
|
|
|
|
|
|
|
|
checkedBgSize()->setSelectedItemIndex(int(pref.bg.type()));
|
|
|
|
checkedBgZoom()->setSelected(pref.bg.zoom());
|
|
|
|
m_checked_bg_color1->setColor(pref.bg.color1());
|
|
|
|
m_checked_bg_color2->setColor(pref.bg.color2());
|
|
|
|
}
|
2014-06-23 08:56:04 +08:00
|
|
|
}
|
|
|
|
|
2014-08-20 11:11:19 +08:00
|
|
|
void onLocateCrashFolder() {
|
2014-08-24 11:19:14 +08:00
|
|
|
app::launcher::open_folder(base::get_file_path(app::memory_dump_filename()));
|
2014-08-20 11:11:19 +08:00
|
|
|
}
|
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
void onLocateConfigFile() {
|
2014-10-17 08:27:25 +08:00
|
|
|
app::launcher::open_folder(app::main_config_filename());
|
2014-06-23 08:56:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ISettings* m_settings;
|
2014-12-28 22:06:11 +08:00
|
|
|
Preferences& m_preferences;
|
2015-02-15 10:31:11 +08:00
|
|
|
DocumentPreferences& m_globPref;
|
2014-12-28 22:06:11 +08:00
|
|
|
DocumentPreferences& m_docPref;
|
2015-02-15 10:31:11 +08:00
|
|
|
DocumentPreferences* m_curPref;
|
2014-06-23 08:56:04 +08:00
|
|
|
ColorButton* m_checked_bg_color1;
|
|
|
|
ColorButton* m_checked_bg_color2;
|
|
|
|
ColorButton* m_pixelGridColor;
|
|
|
|
ColorButton* m_gridColor;
|
|
|
|
ColorButton* m_cursorColor;
|
2015-02-15 09:43:21 +08:00
|
|
|
int& m_curSection;
|
2014-06-23 08:56:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class OptionsCommand : public Command {
|
|
|
|
public:
|
|
|
|
OptionsCommand();
|
2014-08-15 10:07:47 +08:00
|
|
|
Command* clone() const override { return new OptionsCommand(*this); }
|
2014-06-23 08:56:04 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void onExecute(Context* context);
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsCommand::OptionsCommand()
|
|
|
|
: Command("Options",
|
|
|
|
"Options",
|
|
|
|
CmdUIOnlyFlag)
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
2014-12-15 07:19:31 +08:00
|
|
|
Preferences& preferences = App::instance()->preferences();
|
|
|
|
|
2014-10-25 22:24:29 +08:00
|
|
|
ui::MenuBar::setExpandOnMouseover(
|
2014-12-15 07:19:31 +08:00
|
|
|
preferences.general.expandMenubarOnMouseover());
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
2014-06-23 08:56:04 +08:00
|
|
|
void OptionsCommand::onExecute(Context* context)
|
2014-06-14 10:00:49 +08:00
|
|
|
{
|
2015-02-15 09:43:21 +08:00
|
|
|
static int curSection = 0;
|
|
|
|
|
|
|
|
OptionsWindow window(context, curSection);
|
2014-06-23 08:56:04 +08:00
|
|
|
window.openWindowInForeground();
|
2015-02-12 23:16:25 +08:00
|
|
|
if (window.ok())
|
2014-06-23 08:56:04 +08:00
|
|
|
window.saveConfig();
|
2014-06-14 10:00:49 +08:00
|
|
|
}
|
|
|
|
|
2012-01-06 06:45:03 +08:00
|
|
|
Command* CommandFactory::createOptionsCommand()
|
|
|
|
{
|
|
|
|
return new OptionsCommand;
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|