@ -234,7 +234,7 @@ void Window::configure() {
get_style_context ( ) - > add_provider_for_screen ( screen , css_provider_fonts , GTK_STYLE_PROVIDER_PRIORITY_APPLICATION ) ;
}
catch ( const Gtk : : CssProviderError & e ) {
Terminal : : get ( ) . print ( " Error: could not override fonts: " + e . what ( ) + ' \n ' , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : could not override fonts: " + e . what ( ) + ' \n ' , true ) ;
}
}
@ -249,7 +249,7 @@ void Window::configure() {
if ( scheme )
style = scheme - > get_style ( " def:note " ) ;
else {
Terminal : : get ( ) . print ( " Error: Could not find gtksourceview style: " + Config : : get ( ) . source . style + ' \n ' , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : Could not find gtksourceview style: " + Config : : get ( ) . source . style + ' \n ' , true ) ;
}
}
auto foreground_value = style & & style - > property_foreground_set ( ) ? style - > property_foreground ( ) . get_value ( ) : get_style_context ( ) - > get_color ( ) . to_string ( ) ;
@ -292,7 +292,7 @@ void Window::set_menu_actions() {
if ( ! path . empty ( ) ) {
boost : : system : : error_code ec ;
if ( boost : : filesystem : : exists ( path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + path . string ( ) + " already exists. \n " , true ) ;
}
else {
if ( filesystem : : write ( path ) ) {
@ -304,7 +304,7 @@ void Window::set_menu_actions() {
Terminal : : get ( ) . print ( " New file " + path . string ( ) + " created. \n " ) ;
}
else
Terminal : : get ( ) . print ( " Error: could not create new file " + path . string ( ) + " . \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : could not create new file " + path . string ( ) + " . \n " , true ) ;
}
}
} ) ;
@ -322,7 +322,7 @@ void Window::set_menu_actions() {
Terminal : : get ( ) . print ( " New folder " + path . string ( ) + " created. \n " ) ;
}
else
Terminal : : get ( ) . print ( " Error: " + path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + path . string ( ) + " already exists. \n " , true ) ;
Directories : : get ( ) . select ( path ) ;
}
} ) ;
@ -346,22 +346,22 @@ void Window::set_menu_actions() {
build_config = " project(' " + project_name + " ', 'c') \n \n add_project_arguments('-std=c11', '-Wall', '-Wextra', language: 'c') \n \n executable(' " + project_name + " ', 'main.c') \n " ;
}
else {
Terminal : : get ( ) . print ( " Error: build management system " + Config : : get ( ) . project . default_build_management_system + " not supported. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : build management system " + Config : : get ( ) . project . default_build_management_system + " not supported. \n " , true ) ;
return ;
}
auto c_main_path = project_path / " main.c " ;
auto clang_format_path = project_path / " .clang-format " ;
boost : : system : : error_code ec ;
if ( boost : : filesystem : : exists ( build_config_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + build_config_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + build_config_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
if ( boost : : filesystem : : exists ( c_main_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + c_main_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + c_main_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
if ( boost : : filesystem : : exists ( clang_format_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + clang_format_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + clang_format_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
std : : string c_main = " #include <stdio.h> \n \n int main() { \n printf( \" Hello World! \\ n \" ); \n } \n " ;
@ -373,7 +373,7 @@ void Window::set_menu_actions() {
Terminal : : get ( ) . print ( " C project " + project_name + " created. \n " ) ;
}
else
Terminal : : get ( ) . print ( " Error: Could not create project " + project_path . string ( ) + " \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : Could not create project " + project_path . string ( ) + " \n " , true ) ;
}
} ) ;
menu . add_action ( " file_new_project_cpp " , [ ] ( ) {
@ -396,22 +396,22 @@ void Window::set_menu_actions() {
build_config = " project(' " + project_name + " ', 'cpp') \n \n add_project_arguments('-std=c++1y', '-Wall', '-Wextra', language: 'cpp') \n \n executable(' " + project_name + " ', 'main.cpp') \n " ;
}
else {
Terminal : : get ( ) . print ( " Error: build management system " + Config : : get ( ) . project . default_build_management_system + " not supported. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : build management system " + Config : : get ( ) . project . default_build_management_system + " not supported. \n " , true ) ;
return ;
}
auto cpp_main_path = project_path / " main.cpp " ;
auto clang_format_path = project_path / " .clang-format " ;
boost : : system : : error_code ec ;
if ( boost : : filesystem : : exists ( build_config_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + build_config_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + build_config_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
if ( boost : : filesystem : : exists ( cpp_main_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + cpp_main_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + cpp_main_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
if ( boost : : filesystem : : exists ( clang_format_path , ec ) ) {
Terminal : : get ( ) . print ( " Error: " + clang_format_path . string ( ) + " already exists. \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + clang_format_path . string ( ) + " already exists. \n " , true ) ;
return ;
}
std : : string cpp_main = " #include <iostream> \n \n int main() { \n std::cout << \" Hello World! \\ n \" ; \n } \n " ;
@ -423,7 +423,7 @@ void Window::set_menu_actions() {
Terminal : : get ( ) . print ( " C++ project " + project_name + " created. \n " ) ;
}
else
Terminal : : get ( ) . print ( " Error: Could not create project " + project_path . string ( ) + " \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : Could not create project " + project_path . string ( ) + " \n " , true ) ;
}
} ) ;
@ -447,13 +447,13 @@ void Window::set_menu_actions() {
if ( boost : : filesystem : : exists ( view - > file_path , ec ) ) {
std : : ifstream can_read ( view - > file_path . string ( ) ) ;
if ( ! can_read ) {
Terminal : : get ( ) . print ( " Error: could not read " + view - > file_path . string ( ) + " \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : could not read " + view - > file_path . string ( ) + " \n " , true ) ;
return ;
}
can_read . close ( ) ;
}
else {
Terminal : : get ( ) . print ( " Error: " + view - > file_path . string ( ) + " does not exist \n " , true ) ;
Terminal : : get ( ) . print ( " \ e[31m Error\ e[m : " + view - > file_path . string ( ) + " does not exist \n " , true ) ;
return ;
}