From e0531bff0ed4eee50f9c2a360ab138735e513a77 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sat, 14 Sep 2002 03:27:07 +0000 Subject: [PATCH] implement font and display style git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5300 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 7 + src/frontends/qt2/QMath.C | 14 + src/frontends/qt2/QMath.h | 6 + src/frontends/qt2/QMathDialog.C | 137 ++++++--- src/frontends/qt2/QMathDialog.h | 11 +- src/frontends/qt2/ui/QMathDialog.ui | 433 ++++++++++++++++++---------- 6 files changed, 406 insertions(+), 202 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 551fefadfd..17692d7252 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2002-09-14 John Levon + + * ui/QMathDialog.ui: + * QMathDialog.h: + * QMathDialog.C: add back display. Implement + font/style + 2002-09-14 John Levon * ui/QMathDialog.ui: diff --git a/src/frontends/qt2/QMath.C b/src/frontends/qt2/QMath.C index 36d68bedef..971551825c 100644 --- a/src/frontends/qt2/QMath.C +++ b/src/frontends/qt2/QMath.C @@ -72,3 +72,17 @@ void QMath::insert_symbol(string const & name) { current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name)); } + + +void QMath::insertCubeRoot() +{ + current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root")); + current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3")); + current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT)); +} + + +void QMath::toggleDisplay() +{ + current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY)); +} diff --git a/src/frontends/qt2/QMath.h b/src/frontends/qt2/QMath.h index 41d17811b5..e32f67e257 100644 --- a/src/frontends/qt2/QMath.h +++ b/src/frontends/qt2/QMath.h @@ -34,12 +34,18 @@ public: /// insert a math symbol into the doc void insert_symbol(string const & name); + /// insert a cube root + void insertCubeRoot(); + /// add a subscript void subscript(); /// add a superscript void superscript(); + /// switch between display and inline + void toggleDisplay(); + private: /// Apply changes virtual void apply() {}; diff --git a/src/frontends/qt2/QMathDialog.C b/src/frontends/qt2/QMathDialog.C index 87784fb294..2e5185d9a3 100644 --- a/src/frontends/qt2/QMathDialog.C +++ b/src/frontends/qt2/QMathDialog.C @@ -101,14 +101,43 @@ QMathDialog::QMathDialog(QMath * form) connect(symbolsWS, SIGNAL(aboutToShow(int)), this, SLOT(showingPanel(int))); - space_menu_ = new QPopupMenu(spacePB); - space_menu_->insertItem(_("Thin space \\,"), 1); - space_menu_->insertItem(_("Medium space \\:"), 2); - space_menu_->insertItem(_("Thick space \\;"), 3); - space_menu_->insertItem(_("Quadratin space \\quad"), 4); - space_menu_->insertItem(_("Double quadratin space \\qquad"), 5); - space_menu_->insertItem(_("Negative space \\!"), 6); - connect(space_menu_, SIGNAL(activated(int)), this, SLOT(insertSpace(int))); + QPopupMenu * m = new QPopupMenu(spacePB); + m->insertItem(_("Thin space \\,"), 1); + m->insertItem(_("Medium space \\:"), 2); + m->insertItem(_("Thick space \\;"), 3); + m->insertItem(_("Quadratin space \\quad"), 4); + m->insertItem(_("Double quadratin space \\qquad"), 5); + m->insertItem(_("Negative space \\!"), 6); + connect(m, SIGNAL(activated(int)), this, SLOT(insertSpace(int))); + spacePB->setPopup(m); + + m = new QPopupMenu(sqrtPB); + m->insertItem(_("Square root \\sqrt"), 1); + m->insertItem(_("Cube root \\root"), 2); + m->insertItem(_("Other root \\root"), 3); + connect(m, SIGNAL(activated(int)), this, SLOT(insertRoot(int))); + sqrtPB->setPopup(m); + + m = new QPopupMenu(stylePB); + m->insertItem(_("Display style \\displaystyle"), 1); + m->insertItem(_("Normal text style \\textstyle"), 2); + m->insertItem(_("Script (small) style \\scriptstyle"), 3); + m->insertItem(_("Scriptscript (smaller) style \\scriptscriptstyle"), 4); + connect(m, SIGNAL(activated(int)), this, SLOT(insertStyle(int))); + stylePB->setPopup(m); + + m = new QPopupMenu(fontPB); + m->insertItem(_("Roman \\mathrm"), 1); + m->insertItem(_("Bold \\mathbf"), 2); + m->insertItem(_("San serif \\mathsf"), 3); + m->insertItem(_("Italic \\mathit"), 4); + m->insertItem(_("Typewriter \\mathtt"), 5); + m->insertItem(_("Blackboard \\mathbb"), 6); + m->insertItem(_("Fraktur \\mathfrak"), 7); + m->insertItem(_("Calligraphic \\mathcal"), 8); + m->insertItem(_("Normal text mode \\textrm"), 9); + connect(m, SIGNAL(activated(int)), this, SLOT(insertFont(int))); + fontPB->setPopup(m); } @@ -147,21 +176,6 @@ void QMathDialog::addPanel(int num) } -void QMathDialog::insertSpace(int id) -{ - string str; - switch (id) { - case 1: str = ","; break; - case 2: str = ":"; break; - case 3: str = ";"; break; - case 4: str = "quad"; break; - case 5: str = "qquad"; break; - case 6: str = "!"; break; - } - form_->insert_symbol(str); -} - - void QMathDialog::symbol_clicked(string str) { form_->insert_symbol(str); @@ -174,12 +188,6 @@ void QMathDialog::fracClicked() } -void QMathDialog::sqrtClicked() -{ - form_->insert_symbol("sqrt"); -} - - void QMathDialog::delimiterClicked() { } @@ -209,14 +217,9 @@ void QMathDialog::matrixClicked() } -void QMathDialog::spaceClicked() -{ - space_menu_->exec(QCursor::pos()); -} - - -void QMathDialog::styleClicked() +void QMathDialog::equationClicked() { + form_->toggleDisplay(); } @@ -230,3 +233,65 @@ void QMathDialog::superscriptClicked() { form_->superscript(); } + + +void QMathDialog::insertSpace(int id) +{ + string str; + switch (id) { + case 1: str = ","; break; + case 2: str = ":"; break; + case 3: str = ";"; break; + case 4: str = "quad"; break; + case 5: str = "qquad"; break; + case 6: str = "!"; break; + } + form_->insert_symbol(str); +} + + +void QMathDialog::insertRoot(int id) +{ + switch (id) { + case 1: + form_->insert_symbol("sqrt"); + break; + case 2: + form_->insertCubeRoot(); + break; + case 3: + form_->insert_symbol("root"); + break; + } +} + + +void QMathDialog::insertStyle(int id) +{ + string str; + switch (id) { + case 1: str = "displaystyle"; break; + case 2: str = "textstyle"; break; + case 3: str = "scriptstyle"; break; + case 4: str = "scriptscriptstyle"; break; + } + form_->insert_symbol(str); +} + + +void QMathDialog::insertFont(int id) +{ + string str; + switch (id) { + case 1: str = "mathrm"; break; + case 2: str = "mathbf"; break; + case 3: str = "mathsf"; break; + case 4: str = "mathit"; break; + case 5: str = "mathtt"; break; + case 6: str = "mathbb"; break; + case 7: str = "mathfrak"; break; + case 8: str = "mathcal"; break; + case 9: str = "textrm"; break; + } + form_->insert_symbol(str); +} diff --git a/src/frontends/qt2/QMathDialog.h b/src/frontends/qt2/QMathDialog.h index c20b5cb601..e8b988dbdf 100644 --- a/src/frontends/qt2/QMathDialog.h +++ b/src/frontends/qt2/QMathDialog.h @@ -17,7 +17,6 @@ class QMath; class IconPalette; -class QPopupMenu; class QMathDialog : public QMathDialogBase { @@ -32,13 +31,14 @@ public slots: virtual void fracClicked(); virtual void functionSelected(const QString &); virtual void matrixClicked(); - virtual void spaceClicked(); - virtual void sqrtClicked(); - virtual void styleClicked(); virtual void subscriptClicked(); virtual void superscriptClicked(); + virtual void equationClicked(); void symbol_clicked(string str); void insertSpace(int id); + void insertRoot(int id); + void insertStyle(int id); + void insertFont(int id); /// about to show a symbol panel void showingPanel(int); @@ -55,9 +55,6 @@ private: /// owning form QMath * form_; - - /// menu on click of space - QPopupMenu * space_menu_; }; #endif // QMATHDIALOG_H diff --git a/src/frontends/qt2/ui/QMathDialog.ui b/src/frontends/qt2/ui/QMathDialog.ui index 6319dd60b0..4033d38fe3 100644 --- a/src/frontends/qt2/ui/QMathDialog.ui +++ b/src/frontends/qt2/ui/QMathDialog.ui @@ -13,8 +13,8 @@ 0 0 - 331 - 356 + 319 + 357 @@ -38,7 +38,7 @@ QLayoutWidget name - Layout15 + Layout14 @@ -53,7 +53,7 @@ QLayoutWidget name - Layout14 + Layout13 @@ -68,9 +68,9 @@ QLayoutWidget name - Layout13 + Layout9 - + margin 0 @@ -79,11 +79,11 @@ spacing 6 - + QPushButton name - delimitersPB + sqrtPB text @@ -95,14 +95,14 @@ toolTip - Show delimiter and bracket dialog + Insert root - + QPushButton name - subscriptPB + spacePB text @@ -114,10 +114,10 @@ toolTip - Subscript + Insert spacing - + QPushButton name @@ -133,14 +133,14 @@ toolTip - Show text style dialog + Set limits style - + QPushButton name - superscriptPB + fontPB text @@ -152,101 +152,18 @@ toolTip - Superscript - - - - QPushButton - - name - fracPB - - - sizePolicy - - 1 - 1 - - - - text - - - - pixmap - image4 - - - toolTip - Insert fraction (\frac) - - - - QPushButton - - name - matrixPB - - - text - - - - pixmap - image5 - - - toolTip - Show math matrix dialog - - - - QPushButton - - name - spacePB - - - text - - - - pixmap - image6 - - - toolTip - Insert spacing - - - - QPushButton - - name - sqrtPB - - - text - - - - pixmap - image7 - - - toolTip - Insert square root (\sqrt) + Set math font - + QLayoutWidget name - Layout2 + Layout12 - + margin 0 @@ -256,46 +173,250 @@ 6 - QLabel + QLayoutWidget name - functionsLA - - - text - &Functions - - - buddy - functionsLB + Layout10 + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + functionsLA + + + text + &Functions + + + buddy + functionsLB + + + + QListBox + + name + functionsLB + + + sizePolicy + + 1 + 7 + + + + minimumSize + + 100 + 100 + + + + toolTip + Selection a function or operator to insert + + + - QListBox + QLayoutWidget name - functionsLB + Layout18 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + delimitersPB + + + text + + + + pixmap + image4 + + + toolTip + Show delimiter and bracket dialog + + + + QPushButton + + name + matrixPB + + + text + + + + pixmap + image5 + + + toolTip + Show math matrix dialog + + + + QPushButton + + name + subscriptPB + + + text + + + + pixmap + image6 + + + toolTip + Subscript + + + + QPushButton + + name + superscriptPB + + + text + + + + pixmap + image7 + + + toolTip + Superscript + + + + QPushButton + + name + fracPB + + + sizePolicy + + 1 + 1 + + + + text + + + + pixmap + image8 + + + toolTip + Insert fraction (\frac) + + + + QPushButton + + name + equationPB + + + sizePolicy + + 1 + 1 + + + + text + + + + pixmap + image9 + + + toolTip + Toggle between display mode + + + + + name + Spacer4 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + name + Spacer5 - sizePolicy - - 1 - 7 - + orientation + Horizontal - minimumSize - - 100 - 100 - + sizeType + Expanding - toolTip - Selection a function or operator to insert + sizeHint + + 20 + 20 + - - + + @@ -308,7 +429,7 @@ sizePolicy - 5 + 7 3 @@ -612,29 +733,29 @@ 7 7 - image8 + image10 image0 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402c8135756564608813948e289608026ae8710d7c31087e0a12b8ec55fb8c2017bb851215e6aadb900c1776f11 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402c81757460022c5f5901858c431ccd7d34b0403c2e220bb20e2104c481ce24a6ce27ab8c47198439a3bc9096722c56badb90001e46d10 image1 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402a82cae0c0658c4f560c48088278200367120499c38c45f18e25040b238ba7b3000c9e2b5d65c00f2a86971 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325000210543251d2e253d856405bffcbc54105b19c8564e4b330002b014163052c59595952102500605e270408c38cdfc556bcd050072466219 image2 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54103b11c856360003105719c64d4b03abc40220e2ca6000168032d1c5c1249238420442a0a95786b150c5117a50cdc1218e1026208ecb5f7a7a898958c51313a112300743c441826009685840c5216a4124ba3804a0fb17b77a32c5e1818adbbfb5d65c00748269b8 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54103b11c856360003105719c64d4b03abc402f08a2bc3819e5e2218101287ea068b8331c47cb8049a389204b239c81268e2c846a1ba1f5582a0380e7370d88bc39d38fc852b1c480d4f5cf1824dbcd69a0b00d9cc7093 image3 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc40250c59541009b381413144f04032ce27a6082647174f740c531dc4f737188bf30c431c08089d75a7301006ff86b61 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54103b11c856360003105719c64d4b03abc40220e2ca6000168032d1c5c1249238420442a0a95786b150c5117a50cdc1218e1026208ecb5f7a7a898958c51313a112300743c441826009685840c5216a4124ba3804a0fb17b77a32c5e1818adbbfb5d65c00748269b8 image4 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54103b11c856360003105719c64d4b03abc40288105706032ce2708246e238ecc5eace4424408cf850f72f8678ad351700b4f269b9 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402c8135756564608813948e289608026ae8710d7c31087e0a12b8ec55fb8c2017bb851215e6aadb900c1776f11 image5 @@ -642,14 +763,22 @@ image6 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325000210543251d2e253d856405bffcbc54105b19c8564e4b330002b014163052c59595952102500605e270408c38cdfc556bcd050072466219 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402a82cae0c0658c4f560c48088278200367120499c38c45f18e25040b238ba7b3000c9e2b5d65c00f2a86971 image7 - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402c81757460022c5f5901858c431ccd7d34b0403c2e220bb20e2104c481ce24a6ce27ab8c47198439a3bc9096722c56badb90001e46d10 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc40250c59541009b381413144f04032ce27a6082647174f740c531dc4f737188bf30c431c08089d75a7301006ff86b61 image8 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54103b11c856360003105719c64d4b03abc40288105706032ce2708246e238ecc5eace4424408cf850f72f8678ad351700b4f269b9 + + + image9 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232500022630543251d2e253d856405bffcbc54105b19c856360003103711c64d4b03abc402c814574601d4578f4f3c110cb088c30922c57198438a7b06321c50c56badb90087fe6771 + + + image10 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 @@ -666,12 +795,6 @@ QMathDialogBase accept() - - sqrtPB - clicked() - QMathDialogBase - sqrtClicked() - fracPB clicked() @@ -696,38 +819,30 @@ QMathDialogBase delimiterClicked() - - spacePB - clicked() - QMathDialogBase - spaceClicked() - matrixPB clicked() QMathDialogBase matrixClicked() - - stylePB - clicked() - QMathDialogBase - styleClicked() - functionsLB selected(const QString&) QMathDialogBase functionSelected(const QString &) + + equationPB + clicked() + QMathDialogBase + equationClicked() + delimiterClicked() + equationClicked() expandClicked() fracClicked() functionSelected(const QString &) matrixClicked() - spaceClicked() - sqrtClicked() - styleClicked() subscriptClicked() superscriptClicked() -- 2.39.5