Slightly change start up code to run Workbench activate later and some implementations

This commit is contained in:
jriegel 2012-04-05 20:47:02 +02:00 committed by Stefan Tröger
parent 29507a44ed
commit d5663b4122
6 changed files with 43 additions and 7 deletions

View File

@ -1734,7 +1734,7 @@ void Application::runApplication(void)
// Call this before showing the main window because otherwise:
// 1. it shows a white window for a few seconds which doesn't look nice
// 2. the layout of the toolbars is completely broken
app.activateWorkbench(start.c_str());
//app.activateWorkbench(start.c_str());
// show the main window
if (!hidden) {
@ -1766,6 +1766,9 @@ void Application::runApplication(void)
SoDebugError::setHandlerCallback( messageHandlerCoin, 0 );
#endif
app.activateWorkbench(start.c_str());
Instance->d->startingUp = false;

View File

@ -38,7 +38,8 @@ class AssemblyExport ItemPart : public Assembly::Item
public:
ItemPart();
App::PropertyLink Model;
App::PropertyLink Model;
App::PropertyLinkList Annotation;
/** @name methods override feature */
//@{

View File

@ -67,10 +67,13 @@ void CmdAssemblyAddNewPart::activated(int iMsg)
dest = dynamic_cast<Assembly::ItemAssembly*>(Sel.front());
}else if(ActiveAsmObject && ActiveAsmObject->getTypeId().isDerivedFrom(Assembly::ItemAssembly::getClassTypeId())) {
dest = dynamic_cast<Assembly::ItemAssembly*>(ActiveAsmObject);
}else {
}
openCommand("Insert Part");
std::string PartName = getUniqueObjectName("Part.0");
std::string PartName = getUniqueObjectName("Part");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ItemPart','%s')",PartName.c_str());
if(dest){
std::string fatherName = dest->getNameInDocument();
@ -80,7 +83,7 @@ void CmdAssemblyAddNewPart::activated(int iMsg)
Command::addModule(Gui,"PartDesignGui");
std::string BodyName = getUniqueObjectName("Body");
doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')",BodyName.c_str());
doCommand(Doc,"App.activeDocument().%s.Model = App.activeDocument().%s.Items = App.activeDocument().%s ",BodyName.c_str(),BodyName.c_str(),BodyName.c_str());
doCommand(Doc,"App.activeDocument().%s.Model = App.activeDocument().%s ",PartName.c_str(),BodyName.c_str(),BodyName.c_str());
}

View File

@ -29,6 +29,7 @@
#include "ViewProviderPart.h"
//#include <Gui/Command.h>
//#include <Gui/Document.h>
#include <Mod/Assembly/App/ItemPart.h>
using namespace AssemblyGui;
@ -48,3 +49,26 @@ bool ViewProviderItemPart::doubleClicked(void)
}
std::vector<App::DocumentObject*> ViewProviderItemPart::claimChildren(void)const
{
std::vector<App::DocumentObject*> res;
if(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue())
res.push_back( static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
res.insert( res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
return res;
}
std::vector<App::DocumentObject*> ViewProviderItemPart::claimChildren3D(void)const
{
std::vector<App::DocumentObject*> res;
if(static_cast<Assembly::ItemPart*>(getObject())->Model.getValue())
res.push_back( static_cast<Assembly::ItemPart*>(getObject())->Model.getValue());
res.insert( res.end(), static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().begin(),static_cast<Assembly::ItemPart*>(getObject())->Annotation.getValues().end());
return res;
}

View File

@ -41,6 +41,10 @@ public:
virtual bool doubleClicked(void);
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
};

View File

@ -110,8 +110,8 @@ void Workbench::activated()
App::Document *doc = App::GetApplication().getActiveDocument();
if(!doc){
// create a new document
Gui::Command::doCommand(Gui::Command::Doc,"App.newDocument()");
std::string uniqueName = App::GetApplication().getUniqueDocumentName("Assembly1");
Gui::Command::doCommand(Gui::Command::Doc,"App.newDocument('%s')",uniqueName.c_str());
doc = App::GetApplication().getActiveDocument();
}
@ -120,9 +120,10 @@ void Workbench::activated()
if(doc->countObjects()==0){
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Assembly::ItemAssembly','Product')");
Gui::Command::doCommand(Gui::Command::Doc,"AssemblyGui.setActiveAssembly(App.activeDocument().Product)");
}
Gui::Control().showModelView();
}
void Workbench::deactivated()