Explorar el Código

Fix spelling of "strikeOut" in generated XML files (Kate wants the O capitalized).
Implement style and color setting for numbers and symbols and style setting for parentheses.


git-svn-id: file:///var/svn/tigccpp/trunk@796 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler hace 18 años
padre
commit
1c9c9f0817

+ 3 - 1
ktigcc/KTIGCC.prj

@@ -83,7 +83,9 @@ module.include.files=\
 	functions.ui.h\
 	newsdlg.ui.h\
 	toolsdlg.ui.h\
-	toolprops.ui.h
+	toolprops.ui.h\
+	selectcolors.ui.h\
+	selectstyle.ui.h
 
 module.source.name=.
 module.source.type=

+ 1 - 1
ktigcc/preferences.cpp

@@ -371,7 +371,7 @@ static void writeSyntaxXML(const Syn_SettingsForDoc &synprefs,
       ADD_ATTR(itemData,"bold",(idstyle&SYNS_BOLD)?"1":"0");\
       ADD_ATTR(itemData,"underline",(idstyle&SYNS_UNDERLINE)?"1":"0");\
       ADD_ATTR(itemData,"italic",(idstyle&SYNS_ITALIC)?"1":"0");\
-      ADD_ATTR(itemData,"strikeout",(idstyle&SYNS_STRIKEOUT)?"1":"0");\
+      ADD_ATTR(itemData,"strikeOut",(idstyle&SYNS_STRIKEOUT)?"1":"0");\
     }\
   } while(0)
   DEF_ITEM_DATA("Normal",QColor(),0);

+ 67 - 7
ktigcc/preferencesdlg.ui.h

@@ -41,6 +41,8 @@
 #include <kcombobox.h>
 #include <klistview.h>
 #include "ktigcc.h"
+#include "selectstyle.h"
+#include "selectcolors.h"
 
 class RenamableKListViewItem : public KListViewItem {
   public:
@@ -231,7 +233,7 @@ void Preferences::bgColorChange_pressed()
 {
   bgColorChange->setDown(FALSE);
   QColor color=bgColor->backgroundColor();
-  if (KColorDialog::getColor(color,this) == KColorDialog::Accepted) {
+  if (KColorDialog::getColor(color,this)==KColorDialog::Accepted) {
     useBgColor->setChecked(TRUE);
     bgColor->setBackgroundColor(color);
   }
@@ -241,7 +243,7 @@ void Preferences::editorFontChange_pressed()
 {
   editorFontChange->setDown(FALSE);
   QFont font=editorFont->font();
-  if (KFontDialog::getFont(font,TRUE,this) == KFontDialog::Accepted) {
+  if (KFontDialog::getFont(font,TRUE,this)==KFontDialog::Accepted) {
     editorFont->setFont(font);
     editorFont->setText(font.family());
   }
@@ -312,22 +314,62 @@ void Preferences::resetButton_clicked()
 
 void Preferences::numberColorButton_clicked()
 {
-
+  QColor color=preferences.syn->numberColor;
+  if (KColorDialog::getColor(color,this)==KColorDialog::Accepted)
+    preferences.syn->numberColor=color;
 }
 
 void Preferences::numberStyleButton_clicked()
 {
-
+  SelectStyle selectStyle(this);
+  selectStyle.customStyle->setChecked(!!(preferences.syn->numberStyle&SYNS_CUSTOM));
+  if (preferences.syn->numberStyle&SYNS_CUSTOM) {
+    selectStyle.boldChk->setChecked(!!(preferences.syn->numberStyle&SYNS_BOLD));
+    selectStyle.underlineChk->setChecked(!!(preferences.syn->numberStyle&SYNS_UNDERLINE));
+    selectStyle.italicChk->setChecked(!!(preferences.syn->numberStyle&SYNS_ITALIC));
+    selectStyle.strikeoutChk->setChecked(!!(preferences.syn->numberStyle&SYNS_STRIKEOUT));
+  }
+  selectStyle.exec();
+  if (selectStyle.result()==QDialog::Accepted) {
+    preferences.syn->numberStyle=0;
+    if (selectStyle.customStyle->isChecked()) {
+      preferences.syn->numberStyle|=SYNS_CUSTOM;
+      if (selectStyle.boldChk->isChecked()) preferences.syn->numberStyle|=SYNS_BOLD;
+      if (selectStyle.underlineChk->isChecked()) preferences.syn->numberStyle|=SYNS_UNDERLINE;
+      if (selectStyle.italicChk->isChecked()) preferences.syn->numberStyle|=SYNS_ITALIC;
+      if (selectStyle.strikeoutChk->isChecked()) preferences.syn->numberStyle|=SYNS_STRIKEOUT;
+    }
+  }
 }
 
 void Preferences::symbolColorButton_clicked()
 {
-
+  QColor color=preferences.syn->symbolColor;
+  if (KColorDialog::getColor(color,this)==KColorDialog::Accepted)
+    preferences.syn->symbolColor=color;
 }
 
 void Preferences::symbolStyleButton_clicked()
 {
-
+  SelectStyle selectStyle(this);
+  selectStyle.customStyle->setChecked(!!(preferences.syn->symbolStyle&SYNS_CUSTOM));
+  if (preferences.syn->symbolStyle&SYNS_CUSTOM) {
+    selectStyle.boldChk->setChecked(!!(preferences.syn->symbolStyle&SYNS_BOLD));
+    selectStyle.underlineChk->setChecked(!!(preferences.syn->symbolStyle&SYNS_UNDERLINE));
+    selectStyle.italicChk->setChecked(!!(preferences.syn->symbolStyle&SYNS_ITALIC));
+    selectStyle.strikeoutChk->setChecked(!!(preferences.syn->symbolStyle&SYNS_STRIKEOUT));
+  }
+  selectStyle.exec();
+  if (selectStyle.result()==QDialog::Accepted) {
+    preferences.syn->symbolStyle=0;
+    if (selectStyle.customStyle->isChecked()) {
+      preferences.syn->symbolStyle|=SYNS_CUSTOM;
+      if (selectStyle.boldChk->isChecked()) preferences.syn->symbolStyle|=SYNS_BOLD;
+      if (selectStyle.underlineChk->isChecked()) preferences.syn->symbolStyle|=SYNS_UNDERLINE;
+      if (selectStyle.italicChk->isChecked()) preferences.syn->symbolStyle|=SYNS_ITALIC;
+      if (selectStyle.strikeoutChk->isChecked()) preferences.syn->symbolStyle|=SYNS_STRIKEOUT;
+    }
+  }
 }
 
 void Preferences::parenthesisColorsButton_clicked()
@@ -337,7 +379,25 @@ void Preferences::parenthesisColorsButton_clicked()
 
 void Preferences::parenthesisStyleButton_clicked()
 {
-
+  SelectStyle selectStyle(this);
+  selectStyle.customStyle->setChecked(!!(preferences.syn->parenthesisStyle&SYNS_CUSTOM));
+  if (preferences.syn->parenthesisStyle&SYNS_CUSTOM) {
+    selectStyle.boldChk->setChecked(!!(preferences.syn->parenthesisStyle&SYNS_BOLD));
+    selectStyle.underlineChk->setChecked(!!(preferences.syn->parenthesisStyle&SYNS_UNDERLINE));
+    selectStyle.italicChk->setChecked(!!(preferences.syn->parenthesisStyle&SYNS_ITALIC));
+    selectStyle.strikeoutChk->setChecked(!!(preferences.syn->parenthesisStyle&SYNS_STRIKEOUT));
+  }
+  selectStyle.exec();
+  if (selectStyle.result()==QDialog::Accepted) {
+    preferences.syn->parenthesisStyle=0;
+    if (selectStyle.customStyle->isChecked()) {
+      preferences.syn->parenthesisStyle|=SYNS_CUSTOM;
+      if (selectStyle.boldChk->isChecked()) preferences.syn->parenthesisStyle|=SYNS_BOLD;
+      if (selectStyle.underlineChk->isChecked()) preferences.syn->parenthesisStyle|=SYNS_UNDERLINE;
+      if (selectStyle.italicChk->isChecked()) preferences.syn->parenthesisStyle|=SYNS_ITALIC;
+      if (selectStyle.strikeoutChk->isChecked()) preferences.syn->parenthesisStyle|=SYNS_STRIKEOUT;
+    }
+  }
 }
 
 void Preferences::syntaxListView_selectionChanged()

+ 15 - 0
ktigcc/selectcolors.ui

@@ -153,7 +153,22 @@
         <receiver>SelectColors</receiver>
         <slot>reject()</slot>
     </connection>
+    <connection>
+        <sender>colorList</sender>
+        <signal>selectionChanged()</signal>
+        <receiver>SelectColors</receiver>
+        <slot>colorList_selectionChanged()</slot>
+    </connection>
 </connections>
+<includes>
+    <include location="local" impldecl="in implementation">selectcolors.ui.h</include>
+</includes>
+<slots>
+    <slot>colorList_selectionChanged()</slot>
+    <slot>removeButton_clicked()</slot>
+    <slot>addButton_clicked()</slot>
+    <slot>editButton_clicked()</slot>
+</slots>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>

+ 51 - 0
ktigcc/selectcolors.ui.h

@@ -0,0 +1,51 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you want to add, delete, or rename functions or slots, use
+** Qt Designer to update this file, preserving your code.
+**
+** You should not define a constructor or destructor in this file.
+** Instead, write your code in functions called init() and destroy().
+** These will automatically be called by the form's constructor and
+** destructor.
+*****************************************************************************/
+
+/*
+   ktigcc - TIGCC IDE for KDE
+
+   Copyright (C) 2006 Kevin Kofler
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+*/
+
+void SelectColors::colorList_selectionChanged()
+{
+
+}
+
+void SelectColors::removeButton_clicked()
+{
+
+}
+
+void SelectColors::addButton_clicked()
+{
+
+}
+
+void SelectColors::editButton_clicked()
+{
+
+}

+ 12 - 0
ktigcc/selectstyle.ui

@@ -193,6 +193,12 @@
         <receiver>SelectStyle</receiver>
         <slot>reject()</slot>
     </connection>
+    <connection>
+        <sender>customStyle</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>SelectStyle</receiver>
+        <slot>customStyle_toggled(bool)</slot>
+    </connection>
 </connections>
 <tabstops>
     <tabstop>customStyle</tabstop>
@@ -203,6 +209,12 @@
     <tabstop>okButton</tabstop>
     <tabstop>cancelButton</tabstop>
 </tabstops>
+<includes>
+    <include location="local" impldecl="in implementation">selectstyle.ui.h</include>
+</includes>
+<slots>
+    <slot>customStyle_toggled( bool on )</slot>
+</slots>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>

+ 45 - 0
ktigcc/selectstyle.ui.h

@@ -0,0 +1,45 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you want to add, delete, or rename functions or slots, use
+** Qt Designer to update this file, preserving your code.
+**
+** You should not define a constructor or destructor in this file.
+** Instead, write your code in functions called init() and destroy().
+** These will automatically be called by the form's constructor and
+** destructor.
+*****************************************************************************/
+
+/*
+   ktigcc - TIGCC IDE for KDE
+
+   Copyright (C) 2006 Kevin Kofler
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+*/
+
+void SelectStyle::customStyle_toggled(bool on)
+{
+  if (!on) {
+    boldChk->setChecked(FALSE);
+    italicChk->setChecked(FALSE);
+    underlineChk->setChecked(FALSE);
+    strikeoutChk->setChecked(FALSE);
+  }
+  boldChk->setEnabled(on);
+  italicChk->setEnabled(on);
+  underlineChk->setEnabled(on);
+  strikeoutChk->setEnabled(on);
+}