Commit b7e85267 authored by Tilman Benkert's avatar Tilman Benkert

- merged all changes from the integrate_scidavis branch

parent bcee638b
......@@ -52,9 +52,9 @@ set(LabPlot_SRCS ${GUI_SOURCES} ${PLOTS_SOURCES} ${ELEMENTS_SOURCES} ${FILTER_SO
tools/TexRenderer.cc
LabPlot.cc
MainWin.cc
Project.cc
# Project.cc
Spreadsheet.cc
TableModel.cc
# TableModel.cc
Worksheet.cc
)
......@@ -73,8 +73,60 @@ set(UI_SOURCES
gui/ui/settingsprintingpage.ui
)
set(BACKEND_DIR backend)
set(QTFRONTEND_DIR qtfrontend)
INCLUDE_DIRECTORIES(${BACKEND_DIR} ${QTFRONTEND_DIR} .)
set(BACKEND_SOURCES
${BACKEND_DIR}/core/Folder.cpp
${BACKEND_DIR}/core/AbstractAspect.cpp
${BACKEND_DIR}/core/AspectPrivate.cpp
${BACKEND_DIR}/core/globals.cpp
${BACKEND_DIR}/core/AbstractFilter.cpp
${BACKEND_DIR}/core/AbstractSimpleFilter.cpp
${BACKEND_DIR}/core/column/Column.cpp
${BACKEND_DIR}/core/column/ColumnPrivate.cpp
${BACKEND_DIR}/core/column/columncommands.cpp
${BACKEND_DIR}/core/AbstractScriptingEngine.cpp
${BACKEND_DIR}/core/AbstractScript.cpp
${BACKEND_DIR}/core/ScriptingEngineManager.cpp
${BACKEND_DIR}/core/Project.cpp
${BACKEND_DIR}/core/AbstractPart.cpp
${BACKEND_DIR}/core/datatypes/DateTime2StringFilter.cpp
${BACKEND_DIR}/core/datatypes/String2DateTimeFilter.cpp
${BACKEND_DIR}/core/datatypes/Double2StringFilter.cpp
${BACKEND_DIR}/table/Table.cpp
${BACKEND_DIR}/table/tablecommands.cpp
${BACKEND_DIR}/lib/XmlStreamReader.cpp
)
set(QTFRONTEND_SOURCES
${QTFRONTEND_DIR}/core/ProjectExplorer.cpp
${QTFRONTEND_DIR}/core/PartMdiView.cpp
${QTFRONTEND_DIR}/core/AspectTreeModel.cpp
${QTFRONTEND_DIR}/table/TableModel.cpp
)
set(QTMOC_HDRS
${BACKEND_DIR}/core/AbstractColumn.h
${BACKEND_DIR}/core/datatypes/DateTime2DoubleFilter.h
${BACKEND_DIR}/core/datatypes/DayOfWeek2DoubleFilter.h
${BACKEND_DIR}/core/datatypes/Double2DateTimeFilter.h
${BACKEND_DIR}/core/datatypes/Double2DayOfWeekFilter.h
${BACKEND_DIR}/core/datatypes/Double2MonthFilter.h
${BACKEND_DIR}/core/datatypes/Month2DoubleFilter.h
${BACKEND_DIR}/core/datatypes/SimpleCopyThroughFilter.h
${BACKEND_DIR}/core/datatypes/String2DayOfWeekFilter.h
${BACKEND_DIR}/core/datatypes/String2DoubleFilter.h
${BACKEND_DIR}/core/datatypes/String2MonthFilter.h
)
qt4_wrap_cpp(QTMOC_HDRS ${QTMOC_HDRS})
add_definitions(-DSUPPRESS_SCRIPTING_INIT)
kde4_add_ui_files(LabPlot_SRCS ${UI_SOURCES})
kde4_add_executable(LabPlot ${LabPlot_SRCS})
kde4_add_executable(LabPlot ${LabPlot_SRCS} ${BACKEND_SOURCES} ${QTFRONTEND_SOURCES} ${QTMOC_HDRS})
INCLUDE_DIRECTORIES(../liborigin)
target_link_libraries(LabPlot ${KDE4_KDEUI_LIBS} ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES} ${HDF5_LIBRARY} ${NETCDF_LIBRARY} ${CDF_LIBRARY} ${OPJ_LIBRARY})
......
......@@ -34,6 +34,8 @@
#include <KDebug>
#include "MainWin.h"
#include "core/Project.h"
#include "table/Table.h"
int main (int argc, char *argv[]) {
KAboutData aboutData( "LabPlot", "LabPlot",
......@@ -78,6 +80,11 @@ int main (int argc, char *argv[]) {
// kDebug()<<"GSL_VERSION > 1.8"<<endl;
//#endif
// init global defaults
Project::staticInit();
Table::setGlobalDefault("default_comment_visibility", false);
Table::setGlobalDefault("default_column_width", 120);
MainWin* window = new MainWin(0,filename);
window->show();
// sleep(1); // to see splash screen
......
......@@ -25,8 +25,13 @@
<Action name="project" />
</Menu>
<Menu name="edit"><text>&amp;Editklj</text>
<Action name="undo" />
<Action name="redo" />
<Action name="history" />
<Separator/>
<Action name="new spreadsheet" />
<Action name="new worksheet" />
<Action name="new folder" />
<Menu name="new_function_plot">
<text>New Function Plot</text>
<Action name="new_2D_function_plot" />
......
This diff is collapsed.
......@@ -35,23 +35,29 @@
#include "Spreadsheet.h"
#include "Worksheet.h"
#include "Project.h"
#include "elements/Set.h"
#include "plots/Plot.h"
class AbstractAspect;
class Folder;
class ProjectExplorer;
class Table;
class Project;
#include "core/PartMdiView.h"
class MainWin : public KXmlGuiWindow
{
Q_OBJECT
public:
MainWin(QWidget *parent=0,QString filename=0);
int activeSheetIndex() const;
QMdiArea* getMdi() const { return mdi; }
~MainWin();
QMdiArea* getMdi() const { return m_mdi_area; }
Spreadsheet* activeSpreadsheet() const; //!< get active spreadsheet
Spreadsheet* getSpreadsheet(QString title) const; //!< get Spreadsheet of name title
Worksheet* activeWorksheet() const; //!< get active worksheet
Worksheet* getWorksheet(QString name) const; //!< get Worksheet of name title
Project* getProject() const { return project; }
void setProject(Project *p) { project=p; }
Project* getProject() const { return m_project; }
void setProject(Project *p) { m_project=p; }
void updateGUI(); //!< update GUI of main window
void updateSheetList(); //!< update dynamic sheet list menu
void updateSetList(); //!< update dynamic set list menu
......@@ -59,20 +65,38 @@ public:
void saveXML(QIODevice *file); //!< do the actual saving
private:
QMdiArea *mdi;
Project *project;
QMdiArea *m_mdi_area;
Project *m_project;
QMenu *spreadsheetmenu;
KAction *spreadaction;
KAction *m_folderAction;
KAction *m_historyAction;
KAction *m_undoAction;
KAction *m_redoAction;
void setupActions();
void initProjectExplorer();
bool warnModified();
void addSet(Set s, const int sheet, const Plot::PlotType ptype);
AbstractAspect * m_current_aspect;
Folder * m_current_folder;
ProjectExplorer * m_project_explorer;
QDockWidget * m_project_explorer_dock;
void handleAspectAddedInternal(AbstractAspect *aspect);
public slots:
Spreadsheet* newSpreadsheet();
Table* newSpreadsheet();
Folder* newFolder();
Worksheet* newWorksheet();
void save(QString filename=0); //!< save project (.lml format)
void open(QString filename); //!< open project (.lml format)
void saveAs(); //!< save as different file name (.lml format)
void showHistory();
void createContextMenu(QMenu * menu) const;
void createFolderContextMenu(const Folder * folder, QMenu * menu) const;
void undo();
void redo();
//! Show/hide mdi windows depending on the currend folder
void updateMdiWindowVisibility();
private slots:
void openNew();
......@@ -85,6 +109,20 @@ private slots:
void axesDialog();
void legendDialog();
void settingsDialog();
signals:
void partActivated(AbstractPart*);
private slots:
void handleAspectAdded(const AbstractAspect *parent, int index);
void handleAspectAboutToBeRemoved(const AbstractAspect *parent, int index);
void handleAspectRemoved(const AbstractAspect *parent, int index);
void handleAspectDescriptionChanged(const AbstractAspect *aspect);
void handleCurrentAspectChanged(AbstractAspect *aspect);
void handleCurrentSubWindowChanged(QMdiSubWindow*);
void handleSubWindowStatusChange(PartMdiView * view, PartMdiView::SubWindowStatus from, PartMdiView::SubWindowStatus to);
void setMdiWindowVisibility(QAction * action);
};
#endif
This diff is collapsed.
......@@ -32,25 +32,26 @@
#include <QWidget>
#include <QMenu>
#include <QDomElement>
#include <QTableView>
#include <QTableView>
#include "TableModel.h"
#include "table/TableModel.h"
#include "table/Table.h"
#include "elements/Set.h"
#include "sheettype.h"
class QHBoxLayout;
class MainWin;
class Spreadsheet: public QTableView
class Spreadsheet: public QWidget // remark: you could inherit from QTableView here, but that makes it really hard to add any other widget to the view later
{
Q_OBJECT
public:
Spreadsheet(MainWin *m);
Spreadsheet(Table *table);
~Spreadsheet();
SheetType sheetType() const { return type; }
SheetType sheetType() const { return m_type; }
#if 0
void resetHeader(int from=0);
QDomElement save(QDomDocument doc);
void open(QDomNode node);
#endif
void addSet(Set* set);
Set* set(){ return m_set;}
......@@ -61,13 +62,11 @@ public:
QString columnFormat(int col) const;
void setColumnFormat(int col, QString name);
int rowCount() const { return model()->rowCount(); }
void setRowCount(int count) { ((TableModel *)model())->setRowCount(count); }
int columnCount() const { return model()->columnCount(); }
int rowCount() const { return m_table->rowCount(); }
void setRowCount(int count) { m_table->setRowCount(count); }
int columnCount() const { return m_table->columnCount(); }
void setColumnCount(int count){
int oldcount=columnCount();
((TableModel *)model())->setColumnCount(count);
resetHeader(oldcount);
m_table->setColumnCount(count);
}
QString text(int row, int col) const;
......@@ -78,15 +77,12 @@ public:
QList<int> currentColumns() const; //!< returns a sorted list of selected columns
private:
MainWin *mw;
SheetType type; //!< needed for mw->active{Work,Spread}sheet()
Table *m_table;
SheetType m_type; //!< needed for mw->active{Work,Spread}sheet()
QString notes;
Set* m_set;
void contextMenuEvent(QContextMenuEvent *);
QString columnHeader(int col) const;
void setColumnHeader(int col, QString name) {
model()->setHeaderData(col,Qt::Horizontal,name);
}
int filledRows(int col) const; //!< returns number of filled rows in column col
void displaySet();
......@@ -106,6 +102,141 @@ private slots:
void setColumnValues(); //!< set colum values (ColumnValuesDialog)
void deleteSelectedColumns();
void deleteSelectedRows();
//! \name selection related functions
//@{
//! Return how many columns are selected
/**
* If full is true, this function only returns the number of fully
* selected columns.
*/
int selectedColumnCount(bool full = false);
//! Return how many columns with the given plot designation are (at least partly) selected
int selectedColumnCount(SciDAVis::PlotDesignation pd);
//! Returns true if column 'col' is selected; otherwise false
/**
* If full is true, this function only returns true if the whole
* column is selected.
*/
bool isColumnSelected(int col, bool full = false);
//! Return all selected columns
/**
* If full is true, this function only returns a column if the whole
* column is selected.
*/
QList<Column *> selectedColumns(bool full = false);
//! Return how many rows are (at least partly) selected
/**
* If full is true, this function only returns the number of fully
* selected rows.
*/
int selectedRowCount(bool full = false);
//! Returns true if row 'row' is selected; otherwise false
/**
* If full is true, this function only returns true if the whole
* row is selected.
*/
bool isRowSelected(int row, bool full = false);
//! Return the index of the first selected column
/**
* If full is true, this function only looks for fully
* selected columns.
*/
int firstSelectedColumn(bool full = false);
//! Return the index of the last selected column
/**
* If full is true, this function only looks for fully
* selected columns.
*/
int lastSelectedColumn(bool full = false);
//! Return the index of the first selected row
/**
* If full is true, this function only looks for fully
* selected rows.
*/
int firstSelectedRow(bool full = false);
//! Return the index of the last selected row
/**
* If full is true, this function only looks for fully
* selected rows.
*/
int lastSelectedRow(bool full = false);
//! Return whether a cell is selected
bool isCellSelected(int row, int col);
//! Select/Deselect a cell
void setCellSelected(int row, int col, bool select = true);
//! Select/Deselect a range of cells
void setCellsSelected(int first_row, int first_col, int last_row, int last_col, bool select = true);
//! Determine the current cell (-1 if no cell is designated as the current)
void getCurrentCell(int * row, int * col);
//@}
public slots:
void setSelectionAs(SciDAVis::PlotDesignation pd);
void cutSelection();
void copySelection();
void pasteIntoSelection();
void clearSelectedCells();
void maskSelection();
void unmaskSelection();
void fillSelectedCellsWithRowNumbers();
void fillSelectedCellsWithRandomNumbers();
//! Insert columns depending on the selection
void insertEmptyColumns();
void removeSelectedColumns();
void clearSelectedColumns();
void clearSelectedRows();
void setSelectedColumnsAsX();
void setSelectedColumnsAsY();
void setSelectedColumnsAsZ();
void setSelectedColumnsAsXError();
void setSelectedColumnsAsYError();
void setSelectedColumnsAsNone();
void normalizeSelectedColumns();
void normalizeSelection();
//! Insert rows depending on the selection
void insertEmptyRows();
void removeSelectedRows();
//! Append as many columns as are selected
void addColumns();
//! Append as many rows as are selected
void addRows();
void setColumnWidth(int col, int width);
int columnWidth(int col) const;
bool formulaModeActive() const;
public:
static int defaultColumnWidth();
static void setDefaultColumnWidth(int width);
//! Set default for comment visibility for table views
static void setDefaultCommentVisibility(bool visible);
//! Return the default for comment visibility for table views
static bool defaultCommentVisibility();
public slots:
void activateFormulaMode(bool on);
void goToCell(int row, int col);
void rereadSectionSizes();
void selectAll();
void deselectAll();
void handleHorizontalSectionResized(int logicalIndex, int oldSize, int newSize);
void goToNextColumn();
void goToPreviousColumn();
void dimensionsDialog();
void goToCell();
protected:
//! Pointer to the current underlying model
TableModel * m_model;
//! The table view
QTableView * m_view_widget;
QHBoxLayout * m_main_layout;
//! Initialization
void init();
};
#endif //SPREADSHEET
/***************************************************************************
File : AbstractAspect.cpp
Project : SciDAVis
--------------------------------------------------------------------
Copyright : (C) 2007 by Knut Franke, Tilman Benkert
Email (use @ for *) : knut.franke*gmx.de, thzs*gmx.net
Description : Base class for all persistent objects in a Project.
***************************************************************************/
/***************************************************************************
* *
* 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 of the License, 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 *