void IncrementalSearch::OnRelease(bool /*appShutDown*/)
{
    // do de-initialization for your plugin
    // if appShutDown is true, the plugin is unloaded because Em::Blocks is being shut down,
    // which means you must not use any of the SDK Managers
    // NOTE: after this function, the inherited member variable
    // m_IsAttached will be FALSE...
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
    if (cfg->ReadInt(_T("/incremental_search/highlight_default_state"),0) == 2)
    {
        cfg->Write(_T("/incremental_search/highlight_all_occurrences"),m_Highlight);
    }
    if (cfg->ReadInt(_T("/incremental_search/selected_default_state"),0) == 2)
    {
        cfg->Write(_T("/incremental_search/search_selected_only"),m_SelectedOnly);
    }
    if (cfg->ReadInt(_T("/incremental_search/match_case_default_state"),0) == 2)
    {
        cfg->Write(_T("/incremental_search/match_case"),m_flags & wxSCI_FIND_MATCHCASE);
    }
    if (cfg->ReadInt(_T("/incremental_search/regex_default_state"),0) == 2)
    {
        cfg->Write(_T("/incremental_search/regex"),m_flags & wxSCI_FIND_REGEXP);
    }
    m_pTextCtrl->Disconnect(wxEVT_KEY_DOWN);
    m_pTextCtrl->Disconnect(wxEVT_KILL_FOCUS);

    // TODO : KILLERBOT : menu entries should be removed, right ?????
    // TODO : JENS : no, the menubar gets recreated after a plugin changes (install, uninstall or unload), see MainFrame::PluginsUpdated(plugin, status)
}
void AstyleConfigDlg::LoadSettings()
{
  ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("astyle"));
  int style = cfg->ReadInt(_T("/style"), 0);

  XRCCTRL(*this, "spnIndentation",        wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/indentation"),           4));
  XRCCTRL(*this, "chkUseTab",             wxCheckBox)->SetValue(cfg->ReadBool(_T("/use_tabs"),             false));
  XRCCTRL(*this, "chkForceUseTabs",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/force_tabs"),           false));
  XRCCTRL(*this, "chkIndentClasses",      wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_classes"),       false));
  XRCCTRL(*this, "chkIndentSwitches",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_switches"),      false));
  XRCCTRL(*this, "chkIndentCase",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_case"),          false));
  XRCCTRL(*this, "chkIndentBrackets",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_brackets"),      false));
  XRCCTRL(*this, "chkIndentBlocks",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_blocks"),        false));
  XRCCTRL(*this, "chkIndentNamespaces",   wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_namespaces"),    false));
  XRCCTRL(*this, "chkIndentLabels",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_labels"),        false));
  XRCCTRL(*this, "chkIndentPreprocessor", wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_preprocessor"),  false));
  XRCCTRL(*this, "chkIndentCol1Comments", wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_col1_comments"), false));
  XRCCTRL(*this, "cmbPointerAlign",       wxComboBox)->SetValue(cfg->Read(_T("/pointer_align"),            _T("None")));
  XRCCTRL(*this, "chkBreakClosing",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_closing"),        false));
  XRCCTRL(*this, "chkBreakBlocks",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_blocks"),         false));
  XRCCTRL(*this, "chkBreakElseIfs",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_elseifs"),        false));
  XRCCTRL(*this, "chkPadOperators",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_operators"),        false));
  XRCCTRL(*this, "chkPadParensIn",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_parentheses_in"),   false));
  XRCCTRL(*this, "chkPadParensOut",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_parentheses_out"),  false));
  XRCCTRL(*this, "chkPadHeader",          wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_header"),           false));
  XRCCTRL(*this, "chkUnpadParens",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/unpad_parentheses"),    false));
  XRCCTRL(*this, "chkDelEmptyLine",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/delete_empty_lines"),   false));
  XRCCTRL(*this, "chkKeepComplex",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/keep_complex"),         false));
  XRCCTRL(*this, "chkKeepBlocks",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/keep_blocks"),          false));
  XRCCTRL(*this, "chkConvertTabs",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/convert_tabs"),         false));
  XRCCTRL(*this, "chkFillEmptyLines",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/fill_empty_lines"),     false));
  XRCCTRL(*this, "chkAddBrackets",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/add_brackets"),         false));

  SetStyle((AStylePredefinedStyle)style);
}
Example #3
0
wxsGridBagSizerExtra::wxsGridBagSizerExtra():wxsSizerExtra(), colspan(1), rowspan(1), col(-1), row(-1)
{
	ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("wxsmith"));
	rowspan = cfg->ReadInt(_T("/defsizer/rowspan"), rowspan);
	colspan = cfg->ReadInt(_T("/defsizer/colspan"), colspan);
	col = cfg->ReadInt(_T("/defsizer/col"), col);
	row = cfg->ReadInt(_T("/defsizer/row"), row);
}
Example #4
0
void AutosaveConfigDlg::LoadSettings()
{
    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("autosave"));

    XRCCTRL(*this, "do_project", wxCheckBox)->SetValue(cfg->ReadBool(_T("do_project")));
    XRCCTRL(*this, "do_sources", wxCheckBox)->SetValue(cfg->ReadBool(_T("do_sources")));
    XRCCTRL(*this, "project_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), cfg->ReadInt(_T("project_mins"))));
    XRCCTRL(*this, "source_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), cfg->ReadInt(_T("source_mins"))));

    XRCCTRL(*this, "method", wxChoice)->SetSelection(cfg->ReadInt(_T("method"), 2));
}
Example #5
0
void Autosave::Start()
{
    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("autosave"));
    if(cfg->ReadBool(_T("do_project")))
        timer1->Start(60 * 1000 * cfg->ReadInt(_T("project_mins")));
    else
        timer1->Stop();

    if(cfg->ReadBool(_T("do_sources")))
        timer2->Start(60 * 1000 * cfg->ReadInt(_T("source_mins")));
    else
        timer2->Stop();
}
void EditorTweaksConfDlg::SaveSettings()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("EditorTweaks"));
    int oldSavedAlignerEntries = cfg->ReadInt(_T("/aligner/max_saved_entries"), 4);
    int newSavedAlignerEntries = SpinCtrl1->GetValue();

    if(oldSavedAlignerEntries != newSavedAlignerEntries )
        cfg->Write(_T("aligner/max_saved_entries"),newSavedAlignerEntries);

    const int oldBuffer = cfg->ReadInt(wxT("/buffer_caret"), 1);
    const int newBuffer = Choice1->GetSelection();
    if (oldBuffer != newBuffer)
        cfg->Write(wxT("/buffer_caret"), newBuffer);
}
EditorTweaksConfDlg::EditorTweaksConfDlg(wxWindow* parent)
{
	//(*Initialize(EditorTweaksConfDlg)
	wxXmlResource::Get()->LoadObject(this,parent,_T("EditorTweaksConfDlg"),_T("wxPanel"));
	SpinCtrl1 = (wxSpinCtrl*)FindWindow(XRCID("ID_SPINCTRL1"));
	Choice1 = (wxChoice*)FindWindow(XRCID("ID_CHOICE1"));
	//*)
	SpinCtrl1->SetRange(1, 100);

	ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("EditorTweaks"));
    int maxSavedAlignerEntries = cfg->ReadInt(_T("/aligner/max_saved_entries"), 4);
    SpinCtrl1->SetValue(maxSavedAlignerEntries);

    Choice1->SetSelection(cfg->ReadInt(wxT("/buffer_caret"), 1));
}
// class constructor
ClassBrowser::ClassBrowser(wxWindow* parent, NativeParser* np) :
    m_NativeParser(np),
    m_TreeForPopupMenu(0),
    m_Parser(0L),
    m_ClassBrowserSemaphore(0, 1),
    m_ClassBrowserBuilderThread(0)
{
    wxXmlResource::Get()->LoadPanel(this, parent, _T("pnlCB"));
    m_Search = XRCCTRL(*this, "cmbSearch", wxComboBox);

    if (platform::windows)
        m_Search->SetWindowStyle(wxTE_PROCESS_ENTER); // it's a must on windows to catch EVT_TEXT_ENTER

    // Subclassed in XRC file, for reference see here: http://wiki.wxwidgets.org/Resource_Files
    m_CCTreeCtrl       = XRCCTRL(*this, "treeAll",     CCTreeCtrl);
    m_CCTreeCtrlBottom = XRCCTRL(*this, "treeMembers", CCTreeCtrl);

    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
    int filter = cfg->ReadInt(_T("/browser_display_filter"), bdfFile);
    XRCCTRL(*this, "cmbView", wxChoice)->SetSelection(filter);

    XRCCTRL(*this, "splitterWin", wxSplitterWindow)->SetMinSize(wxSize(-1, 200));
    // if the classbrowser is put under the control of a wxFlatNotebook,
    // somehow the main panel is like "invisible" :/
    // so we force the correct color for the panel here...
    XRCCTRL(*this, "MainPanel", wxPanel)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
}
Example #9
0
/** Load the definition of the comments for each language.
 *  @param languages Array of languages.
 *  @see LanguageDef
 */
int LoadSettings(LanguageDef languages[NB_FILETYPES_MAX])
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("codestat"));
    int nb_languages = cfg->ReadInt(_T("/nb_languages"), 0);

    // If no comment styles exist, use and save default ones
    if (nb_languages == 0)
    {
       nb_languages = LoadDefaultSettings(languages);
    }
    // else, load the user settings
    else
    {
        if (nb_languages > NB_FILETYPES_MAX)
           nb_languages = NB_FILETYPES_MAX;
        for (int i=0; i<nb_languages; ++i)
        {
            wxString extensions;
            languages[i].name = cfg->Read(wxString::Format(_T("/l%d/name"),i), _T(""));
            extensions = cfg->Read(wxString::Format(_T("/l%d/ext"),i), _T(""));
            languages[i].ext.Clear();
            wxStringTokenizer tkz(extensions);
            while (tkz.HasMoreTokens())
               languages[i].ext.Add(tkz.GetNextToken());
            languages[i].single_line_comment = cfg->Read(wxString::Format(_T("/l%d/single_line_comment"),i), _T(""));
            languages[i].multiple_line_comment[0] = cfg->Read(wxString::Format(_T("/l%d/multiple_line_comment_begin"),i), _T(""));
            languages[i].multiple_line_comment[1] = cfg->Read(wxString::Format(_T("/l%d/multiple_line_comment_end"),i), _T(""));
        }
    }
    return nb_languages;
}
void EditorTweaks::OnRelease(bool /*appShutDown*/)
{
    m_tweakmenu = 0;

//    EditorHooks::UnregisterHook(m_EditorHookId, true);
    EditorManager* em = Manager::Get()->GetEditorManager();
    for (int i=0;i<em->GetEditorsCount();i++)
    {
        cbEditor* ed=em->GetBuiltinEditor(i);
        if (ed && ed->GetControl())
        {
            ed->GetControl()->Disconnect(wxEVT_NULL,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnKeyPress);
            ed->GetControl()->Disconnect(wxEVT_NULL,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnChar);
        }
    }

    AlignerMenuEntry e;

    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("EditorTweaks"));
    std::sort (AlignerMenuEntries.begin(), AlignerMenuEntries.end(),CompareAlignerMenuEntryObject);
    std::reverse( AlignerMenuEntries.begin(), AlignerMenuEntries.end());
    int i = 0;
    for (; i < cfg->ReadInt(_T("/aligner/max_saved_entries"),defaultStoredAlignerEntries) && i < static_cast<int>(AlignerMenuEntries.size()) ; ++i)
    {
        cfg->Write(wxString::Format(_T("/aligner/first_name_%d"),i),AlignerMenuEntries[i].MenuName);
        cfg->Write(wxString::Format(_T("/aligner/first_argument_string_%d"),i) ,AlignerMenuEntries[i].ArgumentString);

        Disconnect(AlignerMenuEntries[i].id, wxEVT_COMMAND_MENU_SELECTED,  wxCommandEventHandler(EditorTweaks::OnAlign) );
    }
    cfg->Write(_T("/aligner/saved_entries"),i);
    for (; i < static_cast<int>(AlignerMenuEntries.size()) ; ++i)
        Disconnect(AlignerMenuEntries[i].id, wxEVT_COMMAND_MENU_SELECTED,  wxCommandEventHandler(EditorTweaks::OnAlign) );
    cfg->Write(wxT("/suppress_insert_key"), m_suppress_insert);
    cfg->Write(wxT("/convert_braces"),      m_convert_braces);
}
Example #11
0
int ConfigManagerWrapper::ReadInt(const wxString& name, int defaultVal)
{
    if (m_namespace.empty())
        return defaultVal;
    ConfigManager *c = Manager::Get()->GetConfigManager(m_namespace);
    return c->ReadInt(m_basepath + name, defaultVal);
}
// class constructor
WorkspaceBrowserF::WorkspaceBrowserF(wxWindow* parent, NativeParserF* np, ParserF* par)
    : m_NativeParser(np),
    m_TreeForPopupMenu(0),
	m_pParser(par),
	m_pActiveProject(0),
	m_pBrowserBuilder(0)
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("fortran_project"));

    m_BrowserOptions.visibleBottomTree = cfg->ReadBool(_T("/visible_bottom_tree"), true);
    m_BrowserOptions.sortAlphabetically = cfg->ReadBool(_T("/browser_sort_alphabetically"), true);
    m_BrowserOptions.showLocalVariables = cfg->ReadBool(_T("/browser_show_local_variables"), false);
    m_BrowserOptions.showIncludeSeparately = cfg->ReadBool(_T("/browser_show_include_files_separately"), true);

	wxXmlResource::Get()->LoadPanel(this, parent, _T("pnlWBF"));
    m_Search = XRCCTRL(*this, "cmbSearchWBF", wxComboBox);

    if (platform::windows)
		m_Search->SetWindowStyle(wxTE_PROCESS_ENTER); // it's a must on windows to catch EVT_TEXT_ENTER

	m_TreeTop = XRCCTRL(*this, "treeAllWBF", wxTreeCtrl);
	m_TreeBottom = XRCCTRL(*this, "treeMembersWBF", wxTreeCtrl);

    int filter = cfg->ReadInt(_T("/browser_display_filter"), bdfWorkspace);
    XRCCTRL(*this, "cmbViewWBF", wxChoice)->SetSelection(filter);
    m_BrowserOptions.displayFilter = (BrowserDisplayFilter)filter;

    // if the classbrowser is put under the control of a wxFlatNotebook,
    // somehow the main panel is like "invisible" :/
    // so we force the correct color for the panel here...
    XRCCTRL(*this, "WBFMainPanel", wxPanel)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
}
Example #13
0
void CBProfilerConfigDlg::LoadSettings()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("cbprofiler"));

    // Values to be used many times along
    bool annSource = cfg->ReadBool(_T("/ann_source_chk"), false);
    bool minCount  = cfg->ReadBool(_T("/min_count_chk"),  false);

    // Output Options
    XRCCTRL(*this, "chkAnnSource",       wxCheckBox)->SetValue(annSource);
    XRCCTRL(*this, "txtAnnSource",       wxTextCtrl)->SetValue(cfg->Read(_T("/ann_source_txt"),        wxEmptyString));
    XRCCTRL(*this, "chkBrief",           wxCheckBox)->SetValue(cfg->ReadBool(_T("/brief"),             false));
    XRCCTRL(*this, "chkFileInfo",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/file_info"),         false));
    XRCCTRL(*this, "chkUnusedFunctions", wxCheckBox)->SetValue(cfg->ReadBool(_T("/unused_functions"),  false));
    XRCCTRL(*this, "chkStaticCallGraph", wxCheckBox)->SetValue(cfg->ReadBool(_T("/static_call_graph"), false));

    // Analysis Options
    XRCCTRL(*this, "chkNoStatic",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/no_static"),         false));
    XRCCTRL(*this, "chkMinCount",        wxCheckBox)->SetValue(minCount);
    XRCCTRL(*this, "spnMinCount",        wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/min_count_spn"),      0));

    // Miscellaneous Options
    XRCCTRL(*this, "chkSum",             wxCheckBox)->SetValue(cfg->ReadBool(_T("/sum"),               false));

    // Extra Options
    XRCCTRL(*this, "txtExtra",           wxTextCtrl)->SetValue(cfg->Read(_T("/extra_txt"),             wxEmptyString));

    // Enable/Disable the TextCtrl(s) as well as SpinCtrl(s)
    XRCCTRL(*this, "txtAnnSource",       wxTextCtrl)->Enable(annSource);
    XRCCTRL(*this, "spnMinCount",        wxSpinCtrl)->Enable(minCount);
}
Example #14
0
void EditorTweaks::OnShowLineNumbers(wxCommandEvent &/*event*/)
{
    cbStyledTextCtrl* control = GetSafeControl();

    bool enabled=control->GetMarginWidth(0)>0;

//    bool old_state=mgr->ReadBool(_T("/show_line_numbers"), true);
//    mgr->Write(_T("/show_line_numbers"), !enabled);
//    ed->SetEditorStyleAfterFileOpen();
//    mgr->Write(_T("/show_line_numbers"), old_state);

    if (enabled)
        control->SetMarginWidth(0, 0);
    else
    {
        ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
        int pixelWidth = control->TextWidth(wxSCI_STYLE_LINENUMBER, _T("9"));

        if (cfg->ReadBool(_T("/margin/dynamic_width"), false))
        {
            int lineNumWidth = 1;
            int lineCount = control->GetLineCount();

            while (lineCount >= 10)
            {
                lineCount /= 10;
                ++lineNumWidth;
            }

            control->SetMarginWidth(0, 6 + lineNumWidth * pixelWidth);
        }
        else
            control->SetMarginWidth(0, 6 + cfg->ReadInt(_T("/margin/width_chars"), 6) * pixelWidth);
    }
}
Example #15
0
int CppCheck::Execute()
{
    WriteToLog(_("Running cppcheck/vera++ analysis... please wait..."));

    if ( !CheckRequirements() )
        return -1;

    cbProject* Project = Manager::Get()->GetProjectManager()->GetActiveProject();
    if (Project->GetFilesCount() < 1)
        return 0;

    const wxString BasePath = Project->GetBasePath();
    AppendToLog(_T("Switching working directory to : ") + BasePath);
    ::wxSetWorkingDirectory(BasePath);


    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("cppcheck"));
    int choice = cfg->ReadInt(_T("operation"), 0);

    int result_cppcheck = 0;
    int result_vera     = 0;

    if ((0==choice) || (2==choice))
      result_cppcheck = ExecuteCppCheck(Project);

    if ((1==choice) || (2==choice))
      result_vera = ExecuteVera(Project);

    return ((0==result_cppcheck) && (0==result_vera)) ? 0 : -1;
}
Example #16
0
cbDebuggerCommonConfig::Perspective cbDebuggerCommonConfig::GetPerspective()
{
    ConfigManager *c = Manager::Get()->GetConfigManager(wxT("debugger_common"));
    int v = c->ReadInt(wxT("/common/perspective"), static_cast<int>(OnePerDebuggerConfig));
    if (v < OnlyOne || v > OnePerDebuggerConfig)
        return OnePerDebuggerConfig;
    return static_cast<Perspective>(v);
}
Example #17
0
LibSelectDlg::LibSelectDlg(wxWindow* parent,const wxArrayString& Names,bool addOnly)
{
	//(*Initialize(LibSelectDlg)
	wxBoxSizer* BoxSizer1;
	wxStdDialogButtonSizer* StdDialogButtonSizer1;
	wxStaticBoxSizer* StaticBoxSizer1;

	Create(parent, wxID_ANY, _("Setting up libraries"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Select libraries You want to set up:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	BoxSizer1->Add(StaticText1, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND, 10);
	m_Libraries = new wxCheckListBox(this, ID_CHECKLISTBOX1, wxDefaultPosition, wxSize(361,251), 0, 0, 0, wxDefaultValidator, _T("ID_CHECKLISTBOX1"));
	BoxSizer1->Add(m_Libraries, 1, wxTOP|wxLEFT|wxRIGHT|wxEXPAND, 10);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Previous settings"));
	m_DontClear = new wxRadioButton(this, ID_RADIOBUTTON1, _("Do not clear previous results (but remove duplicates)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP, wxDefaultValidator, _T("ID_RADIOBUTTON1"));
	StaticBoxSizer1->Add(m_DontClear, 0, wxEXPAND, 10);
	m_ClearSelected = new wxRadioButton(this, ID_RADIOBUTTON2, _("Clear previous results for selected libraries"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON2"));
	m_ClearSelected->SetValue(true);
	StaticBoxSizer1->Add(m_ClearSelected, 0, wxEXPAND, 10);
	m_ClearAll = new wxRadioButton(this, ID_RADIOBUTTON3, _("Clear all previous libraries settings"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON3"));
	StaticBoxSizer1->Add(m_ClearAll, 0, wxEXPAND, 10);
	BoxSizer1->Add(StaticBoxSizer1, 0, wxALL|wxEXPAND, 10);
	m_SetupGlobalVars = new wxCheckBox(this, ID_CHECKBOX1, _("Set up Global Variables"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
	m_SetupGlobalVars->SetValue(true);
	BoxSizer1->Add(m_SetupGlobalVars, 0, wxLEFT|wxRIGHT|wxEXPAND, 10);
	StdDialogButtonSizer1 = new wxStdDialogButtonSizer();
	StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_OK, wxEmptyString));
	StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_CANCEL, wxEmptyString));
	StdDialogButtonSizer1->Realize();
	BoxSizer1->Add(StdDialogButtonSizer1, 0, wxLEFT|wxRIGHT|wxEXPAND, 10);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
	Center();
	//*)

	if ( (m_AddOnly = addOnly) )
	{
	    m_DontClear->SetValue( true );
	    m_ClearSelected->SetValue( false );
	    m_ClearAll->SetValue( false );
	    m_DontClear->Disable();
	    m_ClearSelected->Disable();
	    m_ClearAll->Disable();
	}

	m_Libraries->Append(Names);

	ConfigManager* Cfg = Manager::Get()->GetConfigManager(_T("lib_finder"));
	switch ( Cfg->ReadInt(_T("libselect/previous"),1) )
	{
	    case 0: m_DontClear->SetValue(true); break;
	    case 2: m_ClearAll->SetValue(true); break;
	    case 1:
	    default: m_ClearSelected->SetValue(true); break;
	}
	m_SetupGlobalVars->SetValue(Cfg->ReadBool(_T("libselect/setup_global_vars"),true));
}
Example #18
0
void ParserBase::ReadOptions()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));

    // one-time default settings change: upgrade everyone
    bool force_all_on = !cfg->ReadBool(_T("/parser_defaults_changed"), false);
    if (force_all_on)
    {
        cfg->Write(_T("/parser_defaults_changed"),       true);

        cfg->Write(_T("/parser_follow_local_includes"),  true);
        cfg->Write(_T("/parser_follow_global_includes"), true);
        cfg->Write(_T("/want_preprocessor"),             true);
        cfg->Write(_T("/parse_complex_macros"),          true);
    }

    // Page "Code Completion"
    m_Options.useSmartSense        = cfg->ReadBool(_T("/use_SmartSense"),                true);
    m_Options.whileTyping          = cfg->ReadBool(_T("/while_typing"),                  true);
    m_Options.caseSensitive        = cfg->ReadBool(_T("/case_sensitive"),                false);

    // Page "C / C++ parser"
    m_Options.followLocalIncludes  = cfg->ReadBool(_T("/parser_follow_local_includes"),  true);
    m_Options.followGlobalIncludes = cfg->ReadBool(_T("/parser_follow_global_includes"), true);
    m_Options.wantPreprocessor     = cfg->ReadBool(_T("/want_preprocessor"),             true);
    m_Options.parseComplexMacros   = cfg->ReadBool(_T("/parse_complex_macros"),          true);

    // Page "Symbol browser"
    m_BrowserOptions.showInheritance = cfg->ReadBool(_T("/browser_show_inheritance"),    false);
    m_BrowserOptions.expandNS        = cfg->ReadBool(_T("/browser_expand_ns"),           false);
    m_BrowserOptions.treeMembers     = cfg->ReadBool(_T("/browser_tree_members"),        true);

    // Token tree
    m_BrowserOptions.displayFilter   = (BrowserDisplayFilter)cfg->ReadInt(_T("/browser_display_filter"), bdfFile);
    m_BrowserOptions.sortType        = (BrowserSortType)cfg->ReadInt(_T("/browser_sort_type"),           bstKind);

    // Page "Documentation:
    m_Options.storeDocumentation     = cfg->ReadBool(_T("/use_documentation_helper"),         false);

    // force e-read of file types
    ParserCommon::EFileType ft_dummy = ParserCommon::FileType(wxEmptyString, true);
    wxUnusedVar(ft_dummy);
}
Example #19
0
void ListCtrlLogger::UpdateSettings()
{
    if (!control)
        return;

    ConfigManager* cfgman = Manager::Get()->GetConfigManager(_T("message_manager"));
    int size = cfgman->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8);
    wxFont default_font(size, fixed ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
    wxFont bold_font(default_font);
    wxFont italic_font(default_font);

    bold_font.SetWeight(wxFONTWEIGHT_BOLD);

    wxFont bigger_font(bold_font);
    bigger_font.SetPointSize(size + 2);

    wxFont small_font(default_font);
    small_font.SetPointSize(size - 4);

    italic_font.SetStyle(wxFONTSTYLE_ITALIC);

    wxColour default_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
    for(unsigned int i = 0; i < num_levels; ++i)
    {
        style[i].font = default_font;
        style[i].colour = default_text_colour;
    }

    ColourManager *colours = Manager::Get()->GetColourManager();

    style[caption].font = bigger_font;
    style[success].colour = colours->GetColour(wxT("logs_success_text"));
    style[failure].colour = colours->GetColour(wxT("logs_failure_text"));

    style[warning].font = italic_font;
    style[warning].colour = colours->GetColour(wxT("logs_warning_text"));

    style[error].colour = colours->GetColour(wxT("logs_error_text"));

    style[critical].font = bold_font;
    style[critical].colour = colours->GetColour(wxT("logs_critical_text_listctrl"));

    style[spacer].font = small_font;
    style[pagetitle] = style[caption];

    // Tell control and items about the font change
    control->SetFont(default_font);
    for (int i = 0; i < control->GetItemCount(); ++i)
    {
        wxFont font = control->GetItemFont(i);
        font.SetPointSize(size);
        control->SetItemFont( i, font );
    }//for
} // end of UpdateSettings
IncrementalSearchConfDlg::IncrementalSearchConfDlg(wxWindow* parent)
{
    wxXmlResource::Get()->LoadObject(this,parent,_T("IncrementalSearchConfDlg"),_T("wxPanel"));

    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));

    // initialise colour-values
    XRCCTRL(*this, "btnIncSearchConfColourFound", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/incremental_search/text_found_colour"), wxColour(160, 32, 240)));
    XRCCTRL(*this, "btnIncSearchConfColourHighlight", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/incremental_search/highlight_colour"), wxColour(255, 165, 0)));
    XRCCTRL(*this, "btnIncSearchConfNotFoundBG", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/incremental_search/text_not_found_colour"), wxColour(255, 127, 127)));
    XRCCTRL(*this, "btnIncSearchConfWrappedBG", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/incremental_search/wrapped_colour"), wxColour(127, 127, 255)));

    // get value from conf-file or predefine them with default value
    XRCCTRL(*this, "chkIncSearchConfCenterText", wxCheckBox)->SetValue(cfg->ReadBool(_T("/incremental_search/center_found_text_on_screen"),true));
    XRCCTRL(*this, "idIncSearchSelectOnEscape", wxCheckBox)->SetValue(cfg->ReadBool(_T("/incremental_search/select_found_text_on_escape"),false));
    XRCCTRL(*this, "idIncSearchSelectOnFocus", wxCheckBox)->SetValue(cfg->ReadBool(_T("/incremental_search/select_text_on_focus"),false));
    XRCCTRL(*this, "idIncSearchHighlightDefault", wxChoice)->SetSelection(cfg->ReadInt(_T("/incremental_search/highlight_default_state"),0));
    XRCCTRL(*this, "idIncSearchSelectedDefault", wxChoice)->SetSelection(cfg->ReadInt(_T("/incremental_search/selected_default_state"),0));
    XRCCTRL(*this, "idIncSearchMatchCaseDefault", wxChoice)->SetSelection(cfg->ReadInt(_T("/incremental_search/match_case_default_state"),0));
    XRCCTRL(*this, "idIncSearchRegExDefault", wxChoice)->SetSelection(cfg->ReadInt(_T("/incremental_search/regex_default_state"),0));
}
void IncrementalSearch::OnAttach()
{
    // do whatever initialization you need for your plugin
    // NOTE: after this function, the inherited member variable
    // m_IsAttached will be TRUE...
    // You should check for it in other functions, because if it
    // is FALSE, it means that the application did *not* "load"
    // (see: does not need) this plugin...
    m_pEditor = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    wxMenuBar* mbar = Manager::Get()->GetAppFrame()->GetMenuBar();
    mbar->Enable(idIncSearchFocus, m_pEditor && m_pEditor->GetControl());

    Manager::Get()->RegisterEventSink(cbEVT_EDITOR_ACTIVATED, new cbEventFunctor<IncrementalSearch, CodeBlocksEvent>(this, &IncrementalSearch::OnEditorEvent));
    Manager::Get()->RegisterEventSink(cbEVT_EDITOR_DEACTIVATED, new cbEventFunctor<IncrementalSearch, CodeBlocksEvent>(this, &IncrementalSearch::OnEditorEvent));
    Manager::Get()->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<IncrementalSearch, CodeBlocksEvent>(this, &IncrementalSearch::OnEditorEvent));
    Manager::Get()->RegisterEventSink(cbEVT_EDITOR_CLOSE, new cbEventFunctor<IncrementalSearch, CodeBlocksEvent>(this, &IncrementalSearch::OnEditorEvent));

    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
    int sel=-1;
    sel = cfg->ReadInt(_T("/incremental_search/highlight_default_state"),0);
    m_Highlight = (sel == 1) || ((sel == 2) && cfg->ReadBool(_T("/incremental_search/highlight_all_occurrences"),false));
    sel = cfg->ReadInt(_T("/incremental_search/selected_default_state"),0);
    m_SelectedOnly = (sel == 1) || ((sel == 2) && cfg->ReadBool(_T("/incremental_search/search_selected_only"),false));
    sel = cfg->ReadInt(_T("/incremental_search/match_case_default_state"),0);
    m_flags |= ((sel == 1) || ((sel == 2) && cfg->ReadInt(_T("/incremental_search/match_case"),false)))?wxSCI_FIND_MATCHCASE:0;
    sel = cfg->ReadInt(_T("/incremental_search/regex_default_state"),0);
    m_flags |= ((sel == 1) || ((sel == 2) && cfg->ReadInt(_T("/incremental_search/regex"),false)))?wxSCI_FIND_REGEXP:0;
}
void Execution::LoadSettings()
{
  ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("HeaderFixup"));
  if (!cfg)
    return;

  if (m_Scope)
    m_Scope->SetSelection(cfg->ReadInt(_T("/scope"), 0));

  if (m_Options)
    m_Options->SetSelection(cfg->ReadInt(_T("/options"), 1));

  if (m_Ignore)
    m_Ignore->SetValue(cfg->ReadBool(_T("/ignore")));

  if (m_FwdDecl)
    m_FwdDecl->SetValue(cfg->ReadBool(_T("/fwd_decl")));

  if (m_ObsoleteLog)
    m_ObsoleteLog->SetValue(cfg->ReadBool(_T("/obsolete_log")));

  if (m_FileType)
    m_FileType->SetSelection(cfg->ReadInt(_T("/file_type"), 2));

  if (m_Protocol)
    m_Protocol->SetValue(cfg->ReadBool(_T("/protocol")));

  if (m_Simulation)
    m_Simulation->SetValue(cfg->ReadBool(_T("/simulation")));

  if (m_Sets)
  {
    for (size_t i=0; i<m_Sets->GetCount(); i++)
    {
      wxString Sel; Sel.Printf(_T("/selection%lu"), static_cast<unsigned long>(i));
      m_Sets->Check(i, cfg->ReadBool(Sel, true));
    }
  }
}// LoadSettings
bool ThreadSearchView::UpdatePreview(const wxString& file, long line)
{
    bool success(true);

    if ( line > 0 )
    {
        // Line display begins at 1 but line index at 0
        line--;
    }

    // Disable read only
    m_pSearchPreview->Enable(false);
    m_pSearchPreview->SetReadOnly(false);

    // Loads file if different from current loaded
    wxFileName filename(file);
    if ( (m_PreviewFilePath != file) || (m_PreviewFileDate != filename.GetModificationTime()) )
    {
        ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));

        // Remember current file path and modification time
        m_PreviewFilePath = file;
        m_PreviewFileDate = filename.GetModificationTime();

        EncodingDetector enc(m_PreviewFilePath, false);
        success = enc.IsOK();
        m_pSearchPreview->SetText(enc.GetWxStr());

        // Colorize
        cbEditor::ApplyStyles(m_pSearchPreview);
        EditorColourSet EdColSet;
        EdColSet.Apply(EdColSet.GetLanguageForFilename(m_PreviewFilePath), m_pSearchPreview, false,
                       true);

        SetFoldingIndicator(mgr->ReadInt(_T("/folding/indicator"), 2));
        UnderlineFoldedLines(mgr->ReadBool(_T("/folding/underline_folded_line"), true));
    }

    if ( success == true )
    {
        // Display the selected line
        int onScreen = m_pSearchPreview->LinesOnScreen() >> 1;
        m_pSearchPreview->GotoLine(line - onScreen);
        m_pSearchPreview->GotoLine(line + onScreen);
        m_pSearchPreview->GotoLine(line);
        m_pSearchPreview->EnsureVisible(line);

        int startPos = m_pSearchPreview->PositionFromLine(line);
        int endPos   = m_pSearchPreview->GetLineEndPosition(line);
        m_pSearchPreview->SetSelectionVoid(endPos, startPos);
    }
Example #24
0
void AutosaveConfigDlg::LoadSettings()
{
    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("autosave"));

    bool doProjects = cfg->ReadBool(_T("do_project"));
    bool doSources = cfg->ReadBool(_T("do_sources"));
    XRCCTRL(*this, "do_project", wxCheckBox)->SetValue(doProjects);
    XRCCTRL(*this, "do_sources", wxCheckBox)->SetValue(doSources);
    XRCCTRL(*this, "do_workspace", wxCheckBox)->SetValue(cfg->ReadBool(_T("do_workspace"), true));
    XRCCTRL(*this, "all_projects", wxCheckBox)->SetValue(cfg->ReadBool(_T("all_projects"), true));
    int minsProjects = std::max(cfg->ReadInt(_T("project_mins"), 1), 1);
    int minsSources = std::max(cfg->ReadInt(_T("source_mins"), 1), 1);
    XRCCTRL(*this, "project_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), minsProjects));
    XRCCTRL(*this, "source_mins", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), minsSources));

    XRCCTRL(*this, "do_workspace", wxCheckBox)->Enable(doProjects);
    XRCCTRL(*this, "all_projects", wxCheckBox)->Enable(doProjects);
    XRCCTRL(*this, "project_mins", wxTextCtrl)->Enable(doProjects);

    XRCCTRL(*this, "source_mins", wxTextCtrl)->Enable(doSources);

    XRCCTRL(*this, "method", wxChoice)->SetSelection(cfg->ReadInt(_T("method"), 2));
}
Example #25
0
void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode, bool enforce)
// TODO (thomas#1#): The non-Windows implementation is *pathetic*.
// However, I don't know how to do it well under GTK / X / Xinerama / whatever.
// Anyone?
{
    int the_mode;

    wxWindow* referenceWindow = Manager::Get()->GetAppWindow();
    if(!referenceWindow) // let's not crash on shutdown
        return;

    if(!w)
        cbThrow(_T("Passed NULL pointer to PlaceWindow."));


    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
    if(!enforce && cfg->ReadBool(_T("/dialog_placement/do_place")) == false)
        return;

    if(mode == pdlBest)
        the_mode = cfg->ReadInt(_T("/dialog_placement/dialog_position"), (int) pdlCentre);
    else
        the_mode = (int) mode;


    if(the_mode == pdlCentre || the_mode == pdlHead)
    {
        w->CentreOnScreen();
        return;
    }
    else
    {
        wxRect windowRect = w->GetRect();
        wxRect parentRect = referenceWindow->GetRect();   // poo again!

        int x1 = windowRect.x;
        int x2 = windowRect.x + windowRect.width;
        int y1 = windowRect.y;
        int y2 = windowRect.y + windowRect.height;

        x1 = std::max(x1, parentRect.x);
        x2 = std::min(x2, parentRect.GetRight());
        y1 = std::max(y1, parentRect.y);
        y2 = std::min(y2, parentRect.GetBottom());

        w->SetSize(x1, y1, x2-x1, y2-y1, wxSIZE_ALLOW_MINUS_ONE);
    }
}
Example #26
0
void EditorTweaks::OnAttach()
{
    // do whatever initialization you need for your plugin
    // NOTE: after this function, the inherited member variable
    // m_IsAttached will be TRUE...
    // You should check for it in other functions, because if it
    // is FALSE, it means that the application did *not* "load"
    // (see: does not need) this plugin...

    Manager* pm = Manager::Get();
    pm->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<EditorTweaks, CodeBlocksEvent>(this, &EditorTweaks::OnEditorOpen));

    m_tweakmenu=NULL;

    EditorManager* em = Manager::Get()->GetEditorManager();
    for (int i=0;i<em->GetEditorsCount();i++)
    {
        cbEditor* ed=em->GetBuiltinEditor(i);
        if (ed && ed->GetControl())
        {
            ed->GetControl()->SetOvertype(false);
            ed->GetControl()->Connect(wxEVT_KEY_DOWN,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnKeyPress,NULL,this);
            ed->GetControl()->Connect(wxEVT_CHAR,(wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction)&EditorTweaks::OnChar,NULL,this);
        }
    }


    AlignerMenuEntry e;

    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("EditorTweaks"));

    for (int i = 0 ; i < cfg->ReadInt(_T("/aligner/saved_entries"),defaultStoredAlignerEntries) ; ++i)
    {
        e.MenuName = cfg->Read(wxString::Format(_T("/aligner/first_name_%d"),i),defaultNames[i]);
        e.ArgumentString = cfg->Read(wxString::Format(_T("/aligner/first_argument_string_%d"),i) ,defaultStrings[i]);
        e.UsageCount = 0;
        e.id = wxNewId();
        AlignerMenuEntries.push_back(e);
        Connect(e.id, wxEVT_COMMAND_MENU_SELECTED,  wxCommandEventHandler(EditorTweaks::OnAlign) );
    }
    m_suppress_insert = cfg->ReadBool(wxT("/suppress_insert_key"), false);
    m_laptop_friendly = cfg->ReadBool(wxT("/laptop_friendly"),     false);
    m_convert_braces  = cfg->ReadBool(wxT("/convert_braces"),      false);
}
Example #27
0
cbDiffEditor::cbDiffEditor(const wxString &leftFile, const wxString &rightFile, int viewmode, bool leftReadOnly, bool rightReadOnly):
    EditorBase((wxWindow*)Manager::Get()->GetEditorManager()->GetNotebook(), leftFile + rightFile),
    diffctrl_(0),
    leftFile_(leftFile),
    rightFile_(rightFile),
    leftReadOnly_(leftReadOnly),
    rightReadOnly_(rightReadOnly)
{
    colorset_.addedlines_ = wxColour(0,255,0,50);
    colorset_.removedlines_ = wxColour(255,0,0,50);
    colorset_.selectedlines_ = wxColour(0,0,255,50);
    colorset_.caretlinetype_ = 0;
    colorset_.caretline_ = wxColor(122,122,0);

    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("cbdiffsettings"));
    if (cfg)
    {
        wxColour add = cfg->ReadColour(_T("addedlines"), wxColour(0,255,0,50));
        int addalpha = cfg->ReadInt(_T("addedlinesalpha"), 50);
        wxColour rem = cfg->ReadColour(_T("removedlines"), wxColour(255,0,0,50));
        int remalpha = cfg->ReadInt(_T("removedlinesalpha"), 50);
        wxColour sel = cfg->ReadColour(_T("selectedlines"), wxColour(0,0,255,50));
        int selalpha = cfg->ReadInt(_T("selectedlinesalpha"), 50);
        colorset_.caretlinetype_ = cfg->ReadInt(_T("caretlinetype"));
        wxColour car = cfg->ReadColour(_T("caretline"), wxColor(122,122,0));
        int caralpha = cfg->ReadInt(_T("caretlinealpha"), 50);
        colorset_.addedlines_ = wxColour(add.Red(), add.Green(), add.Blue(), addalpha);
        colorset_.removedlines_ = wxColour(rem.Red(), rem.Green(), rem.Blue(), remalpha);
        colorset_.selectedlines_ = wxColour(sel.Red(), sel.Green(), sel.Blue(), selalpha);
        colorset_.caretline_ = wxColour(car.Red(), car.Green(), car.Blue(), caralpha);

        if(viewmode == DEFAULT)
            viewmode = cfg->ReadInt(_T("viewmode"), 0) + TABLE;
    }
    HighlightLanguage hl = Manager::Get()->GetEditorManager()->GetColourSet()->GetLanguageForFilename(leftFile_);
    if (hl != HL_NONE)
        colorset_.hlang_ = Manager::Get()->GetEditorManager()->GetColourSet()->GetLanguageName(hl);

    wxBoxSizer* BoxSizer = new wxBoxSizer(wxVERTICAL);
    SetSizer(BoxSizer);
    InitDiffCtrl(viewmode);

    allEditors_.insert(this);

    Reload();

    BoxSizer->Layout();
    Layout();
}
Example #28
0
void ToolsManager::LoadTools()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("tools"));
    wxArrayString list = cfg->EnumerateSubPaths(_("/"));
    for (unsigned int i = 0; i < list.GetCount(); ++i)
    {
        cbTool tool;
        tool.SetName( cfg->Read(_T("/") + list[i] + _T("/name")));
        if (tool.GetName().IsEmpty())
            continue;
        tool.SetCommand(cfg->Read(_T("/") + list[i] + _T("/command")));
        if (tool.GetCommand().IsEmpty())
            continue;
        tool.SetParams(cfg->Read(_T("/") + list[i] + _T("/params")));
        tool.SetWorkingDir(cfg->Read(_T("/") + list[i] + _T("/workingDir")));
        tool.SetLaunchOption(static_cast<cbTool::eLaunchOption>(cfg->ReadInt(_T("/") + list[i] + _T("/launchOption"))));

        AddTool(&tool, false);
    }
    Manager::Get()->GetLogManager()->Log(F(_("Configured %d tools"), m_Tools.GetCount()));
}
Example #29
0
void MiniDocPanel::OnMiniStcLineClick(MiniStyledTextCtrlLineClickedEvent &event)
{
    int line = event.GetLine();

    if ( currentEb_ )
    {
        cbEditor *ed = dynamic_cast<cbEditor*>(currentEb_);
        if(ed)
        {
            cbStyledTextCtrl *stc = ed->GetControl();
            if (stc)
            {
                ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
                int k;
                    /*k = 0; //no adjustment of position
                    k = 3; //selected line 1/3 into screen
                    k = 4; //selected line 1/4 into screen
                    k = 2; //selected line on center
                    k = 1; //selected line on top*/
                k = cfg->ReadInt(_T("mini_doc/pos_of_main"), 2);
                switch (k)
                {
                case 4:
                case 3:
                case 2:
                    stc->ScrollToLine(line - stc->LinesOnScreen()/k);
                    break;
                case 1:
                    stc->ScrollToLine(line);
                    break;
                case 0:
                default:
                    break;
                }

            }
        }
    }
}
cbDiffConfigPanel::cbDiffConfigPanel(wxWindow* parent)
{
	//(*Initialize(cbDiffConfigPanel)
	wxStaticBoxSizer* StaticBoxSizer2;
	wxStaticBoxSizer* StaticBoxSizer5;
	wxBoxSizer* BoxSizer2;
	wxStaticText* StaticText1;
	wxStaticBoxSizer* StaticBoxSizer3;
	wxStaticBoxSizer* StaticBoxSizer4;
	wxBoxSizer* BoxSizer1;
	wxStaticText* StaticText2;
	wxStaticBoxSizer* StaticBoxSizer1;

	Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("wxID_ANY"));
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Added Lines:"));
	BColAdd = new wxButton(this, ID_BUTTON2, _("Colour"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	StaticBoxSizer2->Add(BColAdd, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Alpha:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	StaticBoxSizer2->Add(StaticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SLAddAlpha = new wxSlider(this, ID_SLIDER1, 50, 0, 255, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_SLIDER1"));
	StaticBoxSizer2->Add(SLAddAlpha, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer1->Add(StaticBoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Removed Lines:"));
	BColRem = new wxButton(this, ID_BUTTON1, _("Colour"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	StaticBoxSizer1->Add(BColRem, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Alpha:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	StaticBoxSizer1->Add(StaticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SLRemAlpha = new wxSlider(this, ID_SLIDER2, 50, 0, 255, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_SLIDER2"));
	StaticBoxSizer1->Add(SLRemAlpha, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer1->Add(StaticBoxSizer1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, this, _("Caret Line:"));
	CHCaret = new wxChoice(this, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
	CHCaret->SetSelection( CHCaret->Append(_("Underline")) );
	CHCaret->Append(_("Background"));
	StaticBoxSizer3->Add(CHCaret, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
	BColCar = new wxButton(this, ID_BUTTON3, _("Colour"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
	BoxSizer2->Add(BColCar, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Alpha:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	BoxSizer2->Add(StaticText3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SLCarAlpha = new wxSlider(this, ID_SLIDER3, 50, 0, 255, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_SLIDER3"));
	BoxSizer2->Add(SLCarAlpha, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer3->Add(BoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer1->Add(StaticBoxSizer3, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Default values:"));
	wxString __wxRadioBoxChoices_1[3] =
	{
		_("Tabular"),
		_("Unified Diff"),
		_("Side by side")
	};
	RBViewing = new wxRadioBox(this, ID_RADIOBOX1, _("Displaytype:"), wxDefaultPosition, wxDefaultSize, 3, __wxRadioBoxChoices_1, 1, wxRA_VERTICAL, wxDefaultValidator, _T("ID_RADIOBOX1"));
	RBViewing->SetSelection(0);
	StaticBoxSizer4->Add(RBViewing, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Language:"));
	CHHLang = new wxChoice(this, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE2"));
	StaticBoxSizer5->Add(CHHLang, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer4->Add(StaticBoxSizer5, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer1->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);

	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&cbDiffConfigPanel::OnColAddClick);
	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&cbDiffConfigPanel::OnColRemClick);
	Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&cbDiffConfigPanel::OnColCarClick);
	Connect(ID_RADIOBOX1,wxEVT_COMMAND_RADIOBOX_SELECTED,(wxObjectEventFunction)&cbDiffConfigPanel::OnViewModeChange);
	Connect(ID_CHOICE2,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&cbDiffConfigPanel::OnHLangChange);
	//*)
    BColAdd->SetBackgroundColour(wxColour(0,255,0,50));
    BColRem->SetBackgroundColour(wxColour(255,0,0,50));
    CHCaret->SetSelection(0);
	BColCar->SetBackgroundColour(wxColour(122,122,0));

    CHHLang->Append(cbDiffUtils::GetAllHighlightLanguages());

    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("cbdiffsettings"));
    if (cfg)
    {
        BColAdd->SetBackgroundColour(cfg->ReadColour(_T("addedlines"), wxColour(0,255,0,50)));
        SLAddAlpha->SetValue(cfg->ReadInt(_T("addedlinesalpha"), 50));
        BColRem->SetBackgroundColour(cfg->ReadColour(_T("removedlines"), wxColour(255,0,0,50)));
        SLRemAlpha->SetValue(cfg->ReadInt(_T("removedlinesalpha"),50));
        CHCaret->SetSelection(cfg->ReadInt(_T("caretlinetype")));
        BColCar->SetBackgroundColour(cfg->ReadColour(_T("caretline"), wxColor(122,122,0)));
        SLCarAlpha->SetValue(cfg->ReadInt(_T("caretlinealpha"), 50));
        RBViewing->SetSelection(cfg->ReadInt(_T("viewmode"), 0));
        if(RBViewing->GetSelection() == 1)
            CHHLang->Enable(false);
        CHHLang->SetStringSelection(cfg->Read(_T("hlang"), _("Plain Text")));
    }

    BColAdd->SetLabel(BColAdd->GetBackgroundColour().GetAsString());
    BColRem->SetLabel(BColRem->GetBackgroundColour().GetAsString());
    BColCar->SetLabel(BColCar->GetBackgroundColour().GetAsString());
}