Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10816 → Rev 10817

/trunk/Scribus/scribus/charselect.h
10,23 → 10,13
#include "scribusapi.h"
#include "scrpalettebase.h"
#include "chartablemodel.h"
#include "ui_charselect.h"
 
class QLabel;
class QPushbutton;
class QComboBox;
class QGroupBox;
class QCheckBox;
class QTableView;
 
class FontCombo;
class PageItem;
class UnicodeChooseButton;
class ScribusDoc;
class CharTableView;
 
 
/*! \brief Character Palette for direct chars inserting. */
class SCRIBUS_API CharSelect : public ScrPaletteBase
class SCRIBUS_API CharSelect : public ScrPaletteBase, public Ui::CharSelect
{
Q_OBJECT
 
60,15 → 50,15
int m_characterClass;
 
//! \brief A all font's character table widget.
CharTableView* m_charTable;
// CharTableView* m_charTable;
//! \brief m_charTable model
CharTableModel * m_charTableModel;
 
//! \brief User's defined char palette
CharTableView* m_userTable;
// CharTableView* m_userTable;
//! \brief m_userTable model
CharTableModel * m_userTableModel;
UnicodeChooseButton* unicodeButton;
// UnicodeChooseButton* unicodeButton;
 
QList<CharClassDef> allClasses;
CharClassDef characters;
124,23 → 114,23
PageItem *m_Item;
 
// GUI
QGroupBox* m_bigPalette;
QGroupBox* m_quickPalette;
// QGroupBox* m_bigPalette;
// QGroupBox* m_quickPalette;
 
QLabel* insText;
QLabel* sample;
QLabel* fontLabel;
QLabel* rangeLabel;
// QLabel* insText;
// QLabel* sample;
// QLabel* fontLabel;
// QLabel* rangeLabel;
 
FontCombo* fontSelector;
QComboBox* rangeSelector;
QPushButton* insertButton;
QPushButton* deleteButton;
QCheckBox* hideCheck;
// FontCombo* fontSelector;
// QComboBox* rangeSelector;
// QPushButton* insertButton;
// QPushButton* deleteButton;
// QCheckBox* hideCheck;
 
QPushButton *uniLoadButton;
QPushButton *uniSaveButton;
QPushButton *uniClearButton;
// QPushButton *uniLoadButton;
// QPushButton *uniSaveButton;
// QPushButton *uniClearButton;
 
void saveUserContent(QString f);
void loadUserContent(QString f);
/trunk/Scribus/scribus/charselect.ui
0,0 → 1,272
<ui version="4.0" >
<class>CharSelect</class>
<widget class="QDialog" name="CharSelect" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>698</width>
<height>487</height>
</rect>
</property>
<property name="windowTitle" >
<string>Character Palette</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="m_quickPalette" >
<property name="maximumSize" >
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title" >
<string>Quick Palette</string>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<property name="horizontalSpacing" >
<number>3</number>
</property>
<property name="verticalSpacing" >
<number>3</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="hideCheck" >
<property name="text" >
<string>Hide Enhanced</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="UnicodeChooseButton" name="unicodeButton" >
<property name="text" >
<string>&amp;Search</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>1</number>
</property>
<item>
<widget class="QPushButton" name="uniLoadButton" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uniSaveButton" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uniClearButton" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" >
<widget class="CharTableView" name="m_userTable" >
<property name="dragDropOverwriteMode" >
<bool>false</bool>
</property>
<property name="dragDropMode" >
<enum>QAbstractItemView::DropOnly</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="m_bigPalette" >
<property name="title" >
<string>Enhanced Palette</string>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<property name="horizontalSpacing" >
<number>3</number>
</property>
<property name="verticalSpacing" >
<number>3</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Font:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="FontCombo" name="fontSelector" />
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Character Class:</string>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="ScComboBox" name="rangeSelector" />
</item>
<item row="0" column="5" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="6" >
<widget class="CharTableView" name="m_charTable" >
<property name="minimumSize" >
<size>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>You can see a thumbnail if you press and hold down the right mouse button. The Insert key inserts a Glyph into the Selection below and the Delete key removes the last inserted one</string>
</property>
<property name="dragDropOverwriteMode" >
<bool>false</bool>
</property>
<property name="dragDropMode" >
<enum>QAbstractItemView::DragOnly</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6" >
<widget class="QLabel" name="sample" >
<property name="minimumSize" >
<size>
<width>460</width>
<height>48</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="lineWidth" >
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="6" >
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="insertButton" >
<property name="toolTip" >
<string>Insert the characters at the cursor in the text</string>
</property>
<property name="text" >
<string>&amp;Insert</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton" >
<property name="toolTip" >
<string>Delete the current selection(s).</string>
</property>
<property name="text" >
<string>C&amp;lear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FontCombo</class>
<extends>QComboBox</extends>
<header>fontcombo.h</header>
</customwidget>
<customwidget>
<class>ScComboBox</class>
<extends>QComboBox</extends>
<header>sccombobox.h</header>
</customwidget>
<customwidget>
<class>CharTableView</class>
<extends>QTableView</extends>
<header>chartableview.h</header>
</customwidget>
<customwidget>
<class>UnicodeChooseButton</class>
<extends>QPushButton</extends>
<header>unicodesearch.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/trunk/Scribus/scribus/charselect.cpp
6,13 → 6,6
*/
 
#include <QFileDialog>
#include <QGroupBox>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
#include <QToolTip>
#include <QTextStream>
#include <QMessageBox>
 
#include "scribusdoc.h"
34,111 → 27,31
CharSelect::CharSelect(QWidget* parent)
: ScrPaletteBase(parent, "CharSelect"),
m_doc(0),
m_characterClass(0),
m_Item(0)
{
setWindowTitle( tr("Character Palette"));
setupUi(this);
// layout()->setSizeConstraint(QLayout::SetFixedSize |QLayout::SetDefaultConstraint);
 
paletteFileMask = tr("Scribus Char Palette (*.ucp);;All Files (*)");
 
QGridLayout * mainLayout = new QGridLayout(this);
#ifndef Q_OS_MAC
mainLayout->setSpacing(6);
mainLayout->setMargin(9);
#endif
 
// big table related
m_bigPalette = new QGroupBox(tr("Enhanced Palette"), this);
QGridLayout* bigLayout;
bigLayout = new QGridLayout(m_bigPalette);
#ifndef Q_OS_MAC
bigLayout->setSpacing(6);
bigLayout->setMargin(9);
#endif
 
fontLabel = new QLabel(m_bigPalette);
fontLabel->setText( tr("Font:"));
bigLayout->addWidget(fontLabel, 0, 0, 1, 1);
 
fontSelector = new FontCombo(m_bigPalette);
fontSelector->setMaximumSize(190, 30);
bigLayout->addWidget(fontSelector, 0, 1, 1, 1);
 
rangeLabel = new QLabel(m_bigPalette);
rangeLabel->setText( tr("Character Class:"));
bigLayout->addWidget(rangeLabel, 0, 2, 1, 2);
 
rangeSelector = new ScComboBox(m_bigPalette);
bigLayout->addWidget(rangeSelector, 0, 4, 1, 1);
 
m_characterClass = 0;
 
m_charTable = new CharTableView(m_bigPalette);
m_charTableModel = new CharTableModel(m_bigPalette, 16, m_doc, m_fontInUse);
m_charTable->setModel(m_charTableModel);
m_charTable->resizeColumnsToContents();
m_charTable->resizeRowsToContents();
m_charTable->setMinimumWidth(340);
m_charTable->setDragEnabled(true);
m_charTable->setDragDropMode(QAbstractItemView::DragOnly);
bigLayout->addWidget(m_charTable, 1, 0, 1, 5);
 
sample = new QLabel(m_bigPalette);
sample->setFrameShape(QFrame::Box);
// sample->setPaletteBackgroundColor(paletteBackgroundColor());
sample->setMinimumHeight(48);
sample->setMinimumWidth(460);
bigLayout->addWidget(sample, 2, 0, 1, 5);
 
insertButton = new QPushButton( tr("&Insert"), m_bigPalette);
deleteButton = new QPushButton( tr("C&lear"), m_bigPalette);
bigLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 3, 0, 1, 1);
bigLayout->addWidget(insertButton, 3, 1, 1, 2);
bigLayout->addWidget(deleteButton, 3, 3, 1, 2);
 
mainLayout->addWidget(m_bigPalette, 0, 0, 1, 1);
 
// quick table
m_quickPalette = new QGroupBox(tr("Quick Palette"), this);
QGridLayout* quickLayout = new QGridLayout(m_quickPalette);
#ifndef Q_OS_MAC
quickLayout->setSpacing(6);
quickLayout->setMargin(9);
#endif
 
hideCheck = new QCheckBox( tr("Hide Enhanced"), m_quickPalette);
quickLayout->addWidget(hideCheck, 0, 0, 1, 2);
 
unicodeButton = new UnicodeChooseButton(m_quickPalette);
quickLayout->addWidget(unicodeButton, 1, 0, 1, 1);
 
uniLoadButton = new QPushButton(m_quickPalette);
uniLoadButton->setIcon(loadIcon("22/document-open.png"));
uniSaveButton = new QPushButton(m_quickPalette);
uniSaveButton->setIcon(loadIcon("22/document-save.png"));
uniClearButton = new QPushButton(m_quickPalette);
uniClearButton->setIcon(loadIcon("22/document-new.png"));
quickLayout->addWidget(uniLoadButton, 2, 0, 1, 1);
quickLayout->addWidget(uniSaveButton, 2, 1, 1, 1);
quickLayout->addWidget(uniClearButton, 2, 2, 1, 1);
 
m_userTable = new CharTableView(m_quickPalette);
m_userTableModel = new CharTableModel(m_quickPalette, 4, m_doc, m_fontInUse);
m_userTable->setModel(m_userTableModel);
m_userTable->setMaximumWidth(120);
m_userTable->setMinimumWidth(120);
m_userTable->setAcceptDrops(true);
m_userTable->setDragEnabled(true);
m_userTable->setDragDropMode(QAbstractItemView::DropOnly);
// m_userTable->setDragEnabled(true);
m_userTable->resizeColumnsToContents();
m_userTable->resizeRowsToContents();
quickLayout->addWidget(m_userTable, 3, 0, 1, 3);
 
mainLayout->addWidget(m_quickPalette, 0, 1, 1, 1);
 
//tooltips
insertButton->setToolTip( "<qt>" + tr("Insert the characters at the cursor in the text") + "</qt>");
deleteButton->setToolTip( "<qt>" + tr("Delete the current selection(s).") + "</qt>");
m_charTable->setToolTip( "<qt>" + tr("You can see a thumbnail if you press and hold down the right mouse button. The Insert key inserts a Glyph into the Selection below and the Delete key removes the last inserted one") + "</qt>");
// signals and slots connections
connect(deleteButton, SIGNAL(clicked()), this, SLOT(delEdit()));
connect(insertButton, SIGNAL(clicked()), this, SLOT(insChar()));
155,7 → 68,7
connect(uniLoadButton, SIGNAL(clicked()), this, SLOT(uniLoadButton_clicked()));
connect(uniSaveButton, SIGNAL(clicked()), this, SLOT(uniSaveButton_clicked()));
connect(uniClearButton, SIGNAL(clicked()), this, SLOT(uniClearButton_clicked()));
//
 
loadUserContent(ScPaths::getApplicationDataDir() + "charpalette.ucp");
}
 
618,10 → 531,15
 
void CharSelect::hideCheck_clicked()
{
// megahact #1 to keep user palette unchanged after rasizing
QSize sz(m_quickPalette->size());
//
m_bigPalette->setShown(!hideCheck->isChecked());
resize(1, 1); // megahack to keep palette small
resize(sz); // megahack #2 to keep palette small
m_quickPalette->resize(sz);
updateGeometry();
adjustSize();
}
 
void CharSelect::show()
/trunk/Scribus/scribus/CMakeLists.txt
25,6 → 25,7
SET(SCRIBUS_UI_SRC
aboutplugins.ui
aligndistribute.ui
charselect.ui
createrange.ui
docitemattrprefs.ui
docsections.ui