[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master ec19ca4 3/3: [ftinspect] Make `previous face' a
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master ec19ca4 3/3: [ftinspect] Make `previous face' and `next face' button logic work. |
Date: |
Wed, 04 May 2016 07:09:10 +0000 |
branch: master
commit ec19ca40d97111be31260a7fcefebe43e45d8163
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[ftinspect] Make `previous face' and `next face' button logic work.
It still does nothing, though.
* src/ftinspect.h (MainGUI): New slots `checkCurrentFaceIndex',
`previousFace, and `nextFace'.
New members `numFaces' and `currentFaceIndex'.
* src/ftinspect.cpp
(MainGUI::checkCurrentFaceIndex, MainGUI::previousFace,
MainGUI::nextFace): New methods.
(MainGUI::createConnections): Register connections for
`previousFaceButton' and `nextFaceButton'.
(MainGUI::setDefaults): Updated.
---
ChangeLog | 17 ++++++++++++++++
src/ftinspect.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/ftinspect.h | 6 ++++++
3 files changed, 79 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 11a64aa..642f758 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2016-05-03 Werner Lemberg <address@hidden>
+
+ [ftinspect] Make `previous face' and `next face' button logic work.
+
+ It still does nothing, though.
+
+ * src/ftinspect.h (MainGUI): New slots `checkCurrentFaceIndex',
+ `previousFace, and `nextFace'.
+ New members `numFaces' and `currentFaceIndex'.
+
+ * src/ftinspect.cpp
+ (MainGUI::checkCurrentFaceIndex, MainGUI::previousFace,
+ MainGUI::nextFace): New methods.
+ (MainGUI::createConnections): Register connections for
+ `previousFaceButton' and `nextFaceButton'.
+ (MainGUI::setDefaults): Updated.
+
2016-05-04 Werner Lemberg <address@hidden>
* src/ftinspect.cpp (MainGUI::checkCurrentFontFileIndex): Fix logic.
diff --git a/src/ftinspect.cpp b/src/ftinspect.cpp
index 2ca0ecd..51ef50b 100644
--- a/src/ftinspect.cpp
+++ b/src/ftinspect.cpp
@@ -291,6 +291,32 @@ MainGUI::checkCurrentFontFileIndex()
void
+MainGUI::checkCurrentFaceIndex()
+{
+ if (numFaces < 2)
+ {
+ previousFaceButton->setEnabled(false);
+ nextFaceButton->setEnabled(false);
+ }
+ else if (currentFaceIndex == 0)
+ {
+ previousFaceButton->setEnabled(false);
+ nextFaceButton->setEnabled(true);
+ }
+ else if (currentFaceIndex == numFaces - 1)
+ {
+ previousFaceButton->setEnabled(true);
+ nextFaceButton->setEnabled(false);
+ }
+ else
+ {
+ previousFaceButton->setEnabled(true);
+ nextFaceButton->setEnabled(true);
+ }
+}
+
+
+void
MainGUI::previousFont()
{
if (currentFontFileIndex > 0)
@@ -312,6 +338,28 @@ MainGUI::nextFont()
}
+void
+MainGUI::previousFace()
+{
+ if (currentFaceIndex > 0)
+ {
+ currentFaceIndex--;
+ checkCurrentFaceIndex();
+ }
+}
+
+
+void
+MainGUI::nextFace()
+{
+ if (currentFaceIndex < numFaces - 1)
+ {
+ currentFaceIndex++;
+ checkCurrentFaceIndex();
+ }
+}
+
+
// XXX distances are specified in pixels,
// making the layout dependent on the output device resolution
void
@@ -601,6 +649,10 @@ MainGUI::createConnections()
SLOT(previousFont()));
connect(nextFontButton, SIGNAL(clicked()), this,
SLOT(nextFont()));
+ connect(previousFaceButton, SIGNAL(clicked()), this,
+ SLOT(previousFace()));
+ connect(nextFaceButton, SIGNAL(clicked()), this,
+ SLOT(nextFace()));
}
@@ -663,6 +715,9 @@ MainGUI::setDefaults()
// XXX only dummy values right now
+ numFaces = 0;
+ currentFaceIndex = -1;
+
hintingModeComboBoxx->setCurrentIndex(HintingMode_TrueType_v35);
antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_LCD);
lcdFilterComboBox->setCurrentIndex(LCDFilter_Light);
@@ -679,6 +734,7 @@ MainGUI::setDefaults()
checkShowPoints();
checkUnits();
checkCurrentFontFileIndex();
+ checkCurrentFaceIndex();
}
diff --git a/src/ftinspect.h b/src/ftinspect.h
index ed82dd3..f5e3999 100644
--- a/src/ftinspect.h
+++ b/src/ftinspect.h
@@ -124,19 +124,25 @@ protected:
private slots:
void about();
void checkAntiAliasing();
+ void checkCurrentFaceIndex();
void checkCurrentFontFileIndex();
void checkHintingMode();
void checkShowPoints();
void checkUnits();
void closeFont();
void loadFonts();
+ void nextFace();
void nextFont();
+ void previousFace();
void previousFont();
private:
QStringList fontFileNames;
int currentFontFileIndex;
+ int numFaces;
+ int currentFaceIndex;
+
QAction *aboutAct;
QAction *aboutQtAct;
QAction *closeFontAct;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master ec19ca4 3/3: [ftinspect] Make `previous face' and `next face' button logic work.,
Werner LEMBERG <=