Mercurial > hg > octave-shane
changeset 16626:4adf3c4bd80b
GUI compilation fixes for MSVC.
* libgui/src/dialog.cc (ACTIVE_ESCAPE, RICH_TEXT): Define to 1 instead of
"true".
(LINE_EDIT_FOLLOWS_PROMPT): Define to 0 instead of "false".
*libgui/src/settings-dialog.cc (settings_dialog::read_lexer_settings,
settings_dialog::read_workspace_colors,
settings_dialog::read_terminal_colors): Use QVector instead of C99
non-constant arrays.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 06 May 2013 20:02:08 -0400 |
parents | a86a14e6e65e |
children | de91b1621260 |
files | libgui/src/dialog.cc libgui/src/settings-dialog.cc |
diffstat | 2 files changed, 29 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/dialog.cc +++ b/libgui/src/dialog.cc @@ -163,7 +163,7 @@ // Make the last button the button pressed when <esc> key activated. if (i == N-1) { -#define ACTIVE_ESCAPE true +#define ACTIVE_ESCAPE 1 #if ACTIVE_ESCAPE setEscapeButton (pbutton); #else @@ -231,7 +231,7 @@ for (int j = 0; j < prompt.length (); j++) { if (j > 0) -#define RICH_TEXT true +#define RICH_TEXT 1 #if RICH_TEXT prompt_string.append ("<br>"); #else @@ -327,7 +327,7 @@ : QDialog () { -#define LINE_EDIT_FOLLOWS_PROMPT false +#define LINE_EDIT_FOLLOWS_PROMPT 0 #if LINE_EDIT_FOLLOWS_PROMPT // Prompt on left followed by input on right.
--- a/libgui/src/settings-dialog.cc +++ b/libgui/src/settings-dialog.cc @@ -31,6 +31,7 @@ #include <QSettings> #include <QDir> #include <QFileInfo> +#include <QVector> #ifdef HAVE_QSCINTILLA #include <QScrollArea> @@ -187,11 +188,11 @@ int styles[MaxLexerStyles]; // array for saving valid styles (enum is not continuous) int max_style = get_valid_lexer_styles (lexer, styles); QGridLayout *style_grid = new QGridLayout (); - QLabel *description[max_style]; - QFontComboBox *select_font[max_style]; - QSpinBox *font_size[max_style]; - QCheckBox *attrib_font[3][max_style]; - color_picker *color[max_style]; + QVector<QLabel*> description (max_style); + QVector<QFontComboBox*> select_font (max_style); + QVector<QSpinBox*> font_size (max_style); + QVector<QCheckBox*> attrib_font (3 * max_style); + QVector<color_picker*> color (max_style); int default_size = 10; QFont default_font = QFont (); for (int i = 0; i < max_style; i++) // create dialog elements for all styles @@ -223,25 +224,25 @@ font_size[i]->setValue (actual_font.pointSize ()-default_size); font_size[i]->setToolTip ("Difference to the defalt size"); } - attrib_font[0][i] = new QCheckBox (tr("b")); - attrib_font[1][i] = new QCheckBox (tr("i")); - attrib_font[2][i] = new QCheckBox (tr("u")); - attrib_font[0][i]->setChecked(Qt::Checked && actual_font.bold ()); - attrib_font[0][i]->setObjectName (actual_name+"_bold"); - attrib_font[1][i]->setChecked(Qt::Checked && actual_font.italic ()); - attrib_font[1][i]->setObjectName (actual_name+"_italic"); - attrib_font[2][i]->setChecked(Qt::Checked && actual_font.underline ()); - attrib_font[2][i]->setObjectName (actual_name+"_underline"); + attrib_font[0+3*i] = new QCheckBox (tr("b")); + attrib_font[1+3*i] = new QCheckBox (tr("i")); + attrib_font[2+3*i] = new QCheckBox (tr("u")); + attrib_font[0+3*i]->setChecked(Qt::Checked && actual_font.bold ()); + attrib_font[0+3*i]->setObjectName (actual_name+"_bold"); + attrib_font[1+3*i]->setChecked(Qt::Checked && actual_font.italic ()); + attrib_font[1+3*i]->setObjectName (actual_name+"_italic"); + attrib_font[2+3*i]->setChecked(Qt::Checked && actual_font.underline ()); + attrib_font[2+3*i]->setObjectName (actual_name+"_underline"); color[i] = new color_picker (lexer->color (styles[i])); color[i]->setObjectName (actual_name+"_color"); int column = 1; - style_grid->addWidget (description[i], i,column++); - style_grid->addWidget (select_font[i], i,column++); - style_grid->addWidget (font_size[i], i,column++); - style_grid->addWidget (attrib_font[0][i],i,column++); - style_grid->addWidget (attrib_font[1][i],i,column++); - style_grid->addWidget (attrib_font[2][i],i,column++); - style_grid->addWidget (color[i], i,column++); + style_grid->addWidget (description[i], i, column++); + style_grid->addWidget (select_font[i], i, column++); + style_grid->addWidget (font_size[i], i, column++); + style_grid->addWidget (attrib_font[0+3*i], i, column++); + style_grid->addWidget (attrib_font[1+3*i], i, column++); + style_grid->addWidget (attrib_font[2+3*i], i, column++); + style_grid->addWidget (color[i], i, column++); } // place grid with elements into the tab QScrollArea *scroll_area = new QScrollArea (); @@ -266,8 +267,8 @@ int nr_of_classes = class_chars.length (); QGridLayout *style_grid = new QGridLayout (); - QLabel *description[nr_of_classes]; - color_picker *color[nr_of_classes]; + QVector<QLabel*> description (nr_of_classes); + QVector<color_picker*> color (nr_of_classes); int column = 0; int row = 0; @@ -304,8 +305,8 @@ int nr_of_classes = class_chars.length (); QGridLayout *style_grid = new QGridLayout (); - QLabel *description[nr_of_classes]; - color_picker *color[nr_of_classes]; + QVector<QLabel*> description (nr_of_classes); + QVector<color_picker*> color (nr_of_classes); int column = 0; int row = 0;