m_string = string;
}
void evaluate( StringBuffer& output ){
- #if !(GDEF_OS_WINDOWS)
- // strip .[ExecutableType] entirely (including preceding dot) on Mac and Linux
+ // replace ".[ExecutableType]" with "[ExecutableExt]"
{
StringBuffer output;
- StringBuffer variable;
- bool found_dot = false;
- bool in_variable = false;
- for (const char *i = m_string.c_str(); *i != '\0'; ++i) {
- if (!found_dot && !in_variable) {
- switch (*i) {
- case '.':
- found_dot = true;
- break;
- default:
- output.push_back(*i);
- break;
- }
- } else if (found_dot && !in_variable) {
- switch (*i) {
- case '[':
- in_variable = true;
- break;
- default:
- found_dot = false;
- output.push_back(*i);
- break;
- }
- } else {
- switch (*i) {
- case ']':
- found_dot = false;
- in_variable = false;
- if ( strncmp("ExecutableType", variable.c_str(), sizeof(variable.c_str())) == 0 ) {
- output.push_string("");
- variable.clear();
- }
- break;
- default:
- variable.push_back(*i);
- break;
- }
+ const char *pattern = ".[ExecutableType]";
+ for ( const char *i = m_string.c_str(); *i != '\0'; ++i )
+ {
+ if ( strncmp( pattern, i, sizeof( pattern ) ) == 0 )
+ {
+ output.push_string("[ExecutableExt]");
+ i += strlen( pattern ) - 1;
+ }
+ else
+ {
+ output.push_back(*i);
}
}
setString(output.c_str());
}
- #endif // !(GDEF_OS_WINDOWS)
StringBuffer variable;
bool in_variable = false;
ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 );
+ // FIXME: GTK_WIN_POS_CENTER_ON_PARENT must be used instead but does not work
+ // for unknown reason.
+ // It's possible MaingFrame_getWindow() does not return the main window.
+ // It's known the preferences window has same issue when using MaingFrame_getWindow().
+ gtk_window_set_position( window, GTK_WIN_POS_CENTER_ALWAYS );
+
{
auto table1 = create_dialog_table( 2, 2, 4, 4, 4 );
window.add(table1);