Add Mod/TechDraw/Gui
This commit is contained in:
114
src/Mod/TechDraw/Gui/AppTechDrawGui.cpp
Normal file
114
src/Mod/TechDraw/Gui/AppTechDrawGui.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2007 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Python.h>
|
||||
# include <QFontDatabase>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include <Gui/WidgetFactory.h>
|
||||
|
||||
#include "Workbench.h"
|
||||
|
||||
#include "DlgPrefsDrawingImp.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderView.h"
|
||||
#include "ViewProviderDimension.h"
|
||||
#include "ViewProviderProjGroup.h"
|
||||
#include "ViewProviderProjGroupItem.h"
|
||||
#include "ViewProviderTemplate.h"
|
||||
#include "ViewProviderViewPart.h"
|
||||
#include "ViewProviderViewSection.h"
|
||||
#include "ViewProviderAnnotation.h"
|
||||
#include "ViewProviderSymbol.h"
|
||||
#include "ViewProviderViewClip.h"
|
||||
#include "ViewProviderHatch.h"
|
||||
//#include "resources/qrc_Drawing.cpp"
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
void CreateDrawingCommands(void);
|
||||
void CreateDrawingCommandsDims(void);
|
||||
void CreateDrawingCommandsDecorate(void);
|
||||
|
||||
void loadDrawingResource()
|
||||
{
|
||||
// add resources and reloads the translators
|
||||
Q_INIT_RESOURCE(Drawing);
|
||||
Gui::Translator::instance()->refresh();
|
||||
}
|
||||
|
||||
/* registration table */
|
||||
extern struct PyMethodDef TechDrawGui_Import_methods[];
|
||||
|
||||
|
||||
/* Python entry */
|
||||
extern "C" {
|
||||
void TechDrawGuiExport initTechDrawGui()
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
return;
|
||||
}
|
||||
|
||||
(void) Py_InitModule("TechDrawGui", TechDrawGui_Import_methods); /* mod name, table ptr */
|
||||
Base::Console().Log("Loading GUI of Drawing module... done\n");
|
||||
|
||||
// instantiating the commands
|
||||
CreateDrawingCommands();
|
||||
CreateDrawingCommandsDims();
|
||||
CreateDrawingCommandsDecorate();
|
||||
|
||||
TechDrawGui::Workbench::init();
|
||||
|
||||
//TODO: is this platform independent?? should osifont be added by installer?
|
||||
//Load the osifont for Drawing View
|
||||
// See https://code.google.com/p/osifont/
|
||||
QFontDatabase fontDB;
|
||||
fontDB.addApplicationFont(QString::fromAscii(":/fonts/osifont.ttf"));
|
||||
|
||||
TechDrawGui::ViewProviderDrawingPage::init();
|
||||
TechDrawGui::ViewProviderView::init();
|
||||
|
||||
TechDrawGui::ViewProviderTemplate::init();
|
||||
TechDrawGui::ViewProviderDimension::init();
|
||||
TechDrawGui::ViewProviderViewPart::init();
|
||||
TechDrawGui::ViewProviderProjGroupItem::init();
|
||||
TechDrawGui::ViewProviderProjGroup::init();
|
||||
TechDrawGui::ViewProviderViewSection::init();
|
||||
TechDrawGui::ViewProviderDrawingClip::init();
|
||||
TechDrawGui::ViewProviderAnnotation::init();
|
||||
TechDrawGui::ViewProviderSymbol::init();
|
||||
TechDrawGui::ViewProviderHatch::init();
|
||||
|
||||
// register preferences pages
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsDrawingImp> ("Drawing");
|
||||
|
||||
// add resources and reloads the translators
|
||||
loadDrawingResource();
|
||||
}
|
||||
|
||||
} // extern "C" {
|
||||
Reference in New Issue
Block a user