| 88 | } |
| 89 | |
| 90 | void AppConfig::load( const std::string& confPath, std::string& keybindingsPath, |
| 91 | std::string& initColorScheme, std::vector<std::string>& recentFiles, |
| 92 | std::vector<std::string>& recentFolders, const std::string& resPath, |
| 93 | PluginManager* pluginManager, const Sizei& displaySize, bool sync ) { |
| 94 | keybindingsPath = confPath + "keybindings.cfg"; |
| 95 | ini.loadFromFile( confPath + "config.cfg" ); |
| 96 | iniState.loadFromFile( confPath + "state.cfg" ); |
| 97 | std::string recent = iniState.getValue( "files", "recentfiles", "" ); |
| 98 | recentFiles = urlDecode( String::split( recent, ';' ) ); |
| 99 | std::string recentFol = iniState.getValue( "folders", "recentfolders", "" ); |
| 100 | recentFolders = urlDecode( String::split( recentFol, ';' ) ); |
| 101 | initColorScheme = editor.colorScheme = ini.getValue( "editor", "colorscheme", "eepp" ); |
| 102 | editor.fontSize = ini.getValue( "editor", "font_size", "11dp" ); |
| 103 | const Sizei desiredRes( 1280, 720 ); |
| 104 | Sizei defWinSize( desiredRes.getWidth(), desiredRes.getHeight() ); |
| 105 | if ( displaySize.getWidth() > desiredRes.getWidth() && |
| 106 | displaySize.getWidth() - desiredRes.getWidth() > 60 ) { |
| 107 | defWinSize.setWidth( desiredRes.getWidth() ); |
| 108 | } else { |
| 109 | defWinSize.setWidth( displaySize.getWidth() - 60 ); |
| 110 | } |
| 111 | if ( displaySize.getHeight() > desiredRes.getHeight() && |
| 112 | displaySize.getHeight() - desiredRes.getHeight() > 60 ) { |
| 113 | defWinSize.setHeight( desiredRes.getHeight() ); |
| 114 | } else { |
| 115 | defWinSize.setHeight( displaySize.getHeight() - 60 ); |
| 116 | } |
| 117 | windowState.size.setWidth( iniState.getValueI( "window", "width", defWinSize.getWidth() ) ); |
| 118 | windowState.size.setHeight( iniState.getValueI( "window", "height", defWinSize.getHeight() ) ); |
| 119 | windowState.maximized = iniState.getValueB( "window", "maximized", false ); |
| 120 | windowState.pixelDensity = iniState.getValueF( "window", "pixeldensity" ); |
| 121 | windowState.winIcon = ini.getValue( "window", "winicon", resPath + "icon/ecode.png" ); |
| 122 | windowState.panelPartition = iniState.getValue( "window", "panel_partition", "15%" ); |
| 123 | windowState.statusBarPartition = iniState.getValue( "window", "status_bar_partition", "85%" ); |
| 124 | windowState.displayIndex = iniState.getValueI( "window", "display_index", 0 ); |
| 125 | windowState.position.x = iniState.getValueI( "window", "x", -1 ); |
| 126 | windowState.position.y = iniState.getValueI( "window", "y", -1 ); |
| 127 | windowState.lastRunVersion = iniState.getValueU( "editor", "last_run_version", 0 ); |
| 128 | windowState.sidePanelTabsOrder = |
| 129 | String::split( iniState.getValue( "ui", "side_panel_tabs_order", "" ), ',' ); |
| 130 | editor.showLineNumbers = ini.getValueB( "editor", "show_line_numbers", true ); |
| 131 | editor.showWhiteSpaces = ini.getValueB( "editor", "show_white_spaces", true ); |
| 132 | editor.showLineEndings = ini.getValueB( "editor", "show_line_endings", false ); |
| 133 | editor.showIndentationGuides = ini.getValueB( "editor", "show_indentation_guides", false ); |
| 134 | editor.highlightMatchingBracket = |
| 135 | ini.getValueB( "editor", "highlight_matching_brackets", true ); |
| 136 | editor.highlightCurrentLine = ini.getValueB( "editor", "highlight_current_line", true ); |
| 137 | editor.verticalScrollbar = ini.getValueB( "editor", "vertical_scrollbar", true ); |
| 138 | editor.horizontalScrollbar = ini.getValueB( "editor", "horizontal_scrollbar", true ); |
| 139 | editor.openDocumentsInMainSplit = |
| 140 | ini.getValueB( "editor", "open_documents_in_main_split", false ); |
| 141 | ui.fontSize = ini.getValue( "ui", "font_size", "11dp" ); |
| 142 | ui.panelFontSize = ini.getValue( "ui", "panel_font_size", "11dp" ); |
| 143 | ui.showSidePanel = ini.getValueB( "ui", "show_side_panel", true ); |
| 144 | ui.showStatusBar = ini.getValueB( "ui", "show_status_bar", true ); |
| 145 | ui.showMenuBar = ini.getValueB( "ui", "show_menu_bar", false ); |
| 146 | ui.welcomeScreen = ini.getValueB( "ui", "welcome_screen", true ); |
| 147 | ui.openFilesInNewWindow = ini.getValueB( "ui", "open_files_in_new_window", false ); |