1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2014 Eran Ifrah
// file name : editorsettingsdockingwidows.cpp
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#include "editorsettingsdockingwidows.h"
#include "cl_config.h"
#include "cl_defs.h"
#include "wxStringHash.h"
EditorSettingsDockingWindows::EditorSettingsDockingWindows(wxWindow* parent, OptionsConfigPtr options)
: OptionsConfigPage(parent, options)
{
AddHeader(_("Tabs"));
#if !CL_USE_NATIVEBOOK
const std::unordered_map<wxString, int> tab_height_map = { { "TALL", OptionsConfig::nbTabHt_Tall },
{ "MEDIUM", OptionsConfig::nbTabHt_Medium },
{ "SHORT", OptionsConfig::nbTabHt_Short },
{ "TINY", OptionsConfig::nbTabHt_Tiny } };
std::unordered_map<int, wxString> tab_height_map_reverse = { { OptionsConfig::nbTabHt_Tall, "TALL" },
{ OptionsConfig::nbTabHt_Medium, "MEDIUM" },
{ OptionsConfig::nbTabHt_Short, "SHORT" },
{ OptionsConfig::nbTabHt_Tiny, "TINY" } };
std::vector<wxString> tab_heights = { "TALL", "MEDIUM", "SHORT", "TINY" };
AddProperty(_("Height"), tab_heights, tab_height_map_reverse.find(m_options->GetNotebookTabHeight())->second,
[this, tab_height_map](const wxString& label, const wxAny& value) {
wxString value_str;
if(value.GetAs(&value_str)) {
m_options->SetNotebookTabHeight(tab_height_map.find(value_str)->second);
}
});
#endif
std::unordered_map<wxString, wxDirection> orientation_map = { { "UP", wxUP }, { "DOWN", wxDOWN } };
std::unordered_map<int, wxString> orientation_map_reverse = { { wxUP, "UP" }, { wxDOWN, "DOWN" } };
AddProperty(_("Workspace tabs orientation"), std::vector<wxString>{ "UP", "DOWN" },
orientation_map_reverse[m_options->GetWorkspaceTabsDirection()],
[this, orientation_map](const wxString&, const wxAny& value) mutable {
wxString str_value;
if(value.GetAs(&str_value)) {
m_options->SetWorkspaceTabsDirection(orientation_map[str_value]);
}
});
AddProperty(_("Output tabs orientation"), std::vector<wxString>{ "UP", "DOWN" },
orientation_map_reverse[m_options->GetOutputTabsDirection()],
[this, orientation_map](const wxString&, const wxAny& value) mutable {
wxString str_value;
if(value.GetAs(&str_value)) {
m_options->SetOutputTabsDirection(orientation_map[str_value]);
}
});
#if !CL_USE_NATIVEBOOK
AddProperty(_("Show close button on tabs"), m_options->IsTabHasXButton(), UPDATE_BOOL_CB(SetTabHasXButton));
#endif
AddProperty(_("Show file path on tab label"), m_options->IsTabShowPath(), UPDATE_BOOL_CB(SetTabShowPath));
#if !CL_USE_NATIVEBOOK
AddProperty(_("Mouse scroll switch bewtween tabs"), m_options->IsMouseScrollSwitchTabs(),
UPDATE_BOOL_CB(SetMouseScrollSwitchTabs));
#endif
AddProperty(_("Sort tab file list"), m_options->IsSortTabsDropdownAlphabetically(),
UPDATE_BOOL_CB(SetSortTabsDropdownAlphabetically));
AddProperty(_("Use Ctrl+TAB to switch tabs"), m_options->IsCtrlTabEnabled(), UPDATE_BOOL_CB(SetCtrlTabEnabled));
#ifndef __WXGTK__
AddProperty(_("Hide main tab bar"), clConfig::Get().Read("HideTabBar", false),
UPDATE_CLCONFIG_BOOL_CB("HideTabBar"));
#endif
AddHeader(_("Find in files"));
AddProperty(_("Don't automatically fold search results"), m_options->GetDontAutoFoldResults(),
UPDATE_BOOL_CB(SetDontAutoFoldResults));
AddProperty(_("When searching, don't override search string with current selection"),
m_options->GetDontOverrideSearchStringWithSelection(),
UPDATE_BOOL_CB(SetDontOverrideSearchStringWithSelection));
}
|