From ffcfc5119a724814af0f0fa2d9ea95063681daad Mon Sep 17 00:00:00 2001 From: fabiantheblind Date: Sat, 2 Jul 2011 22:14:56 +0200 Subject: [PATCH] before building files --- MPOLnch.fr | 30 +++++++++++++---------- MPOLnchActionComponent.cpp | 25 +++++++++++++++++-- MPOLnchFactoryList.h | 4 +-- MPOLnchListBoxObserver.cpp | 50 +++++++++++++++++++++++++++++++++++--- MPOLnchNodeID.cpp | 12 ++++++++- MPOLnchNodeID.h | 8 +++++- MPOLnch_enUS.fr | 28 ++++++++++----------- mpolnchicopng.fr | 34 ++++++++++++++++++++++++++ scriptfile01.jsx | 1 + scriptfile02.jsx | 1 + scriptfile03.jsx | 1 + scriptfile04.jsx | 1 + scriptfile05.jsx | 1 + scriptfile06.jsx | 1 + scriptfile07.jsx | 1 + scriptfile08.jsx | 1 + scriptfile09.jsx | 1 + scriptfile10.jsx | 1 + scriptfile11.jsx | 1 + scriptfile12.jsx | 1 + 20 files changed, 167 insertions(+), 36 deletions(-) create mode 100644 mpolnchicopng.fr create mode 100644 scriptfile01.jsx create mode 100644 scriptfile02.jsx create mode 100644 scriptfile03.jsx create mode 100644 scriptfile04.jsx create mode 100644 scriptfile05.jsx create mode 100644 scriptfile06.jsx create mode 100644 scriptfile07.jsx create mode 100644 scriptfile08.jsx create mode 100644 scriptfile09.jsx create mode 100644 scriptfile10.jsx create mode 100644 scriptfile11.jsx create mode 100644 scriptfile12.jsx diff --git a/MPOLnch.fr b/MPOLnch.fr index 91d1f49..649db0a 100644 --- a/MPOLnch.fr +++ b/MPOLnch.fr @@ -1,6 +1,6 @@ //======================================================================================== // -// $File: //depot/indesign_6.0/highprofile/source/sdksamples/wlistboxcomposite/MPOLnch.fr $ +// $File: //depot/indesign_6.0/highprofile/source/sdksamples/mpolauncher/MPOLnch.fr $ // // Owner: Adobe Developer Technologies // @@ -51,6 +51,8 @@ #include "AboutBoxID.h" // for kAboutBoxStaticTextViewImpl #include "TreeViewDefs.h" + + // Project includes: #include "MPOLnchID.h" #include "MPOLnchRezDefs.h" @@ -82,7 +84,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID) /** This boss class provides the actions invoked by this plug-in's sub-menu items. - @ingroup wlistboxcomposite + @ingroup mpolauncher */ Class { @@ -98,7 +100,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID) /** Controls addition of a pop-up menu to the panel. - @ingroup wlistboxcomposite + @ingroup mpolauncher */ Class { @@ -116,7 +118,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID) /** Gives a list-box (tree view) that has additional observer added... to get selection change notifications - @ingroup wlistboxcomposite + @ingroup mpolauncher */ Class { @@ -150,7 +152,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID) /** Adds observer to the 'eyeball' button. - @ingroup wlistboxcomposite + @ingroup mpolauncher */ Class { @@ -166,7 +168,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID) /** Adds observer to the 'Pen' button - @ingroup wlistboxcomposite + @ingroup mpolauncher */ Class { @@ -363,7 +365,7 @@ resource PanelList (kSDKDefPanelResourceID) // 1st panel in the list kSDKDefPanelResourceID, // Resource ID for this panel (use SDK default rsrc ID) kMPOLnchPluginID, // ID of plug-in that owns this panel - kNotResizable, + kIsResizable, kMPOLnchPanelWidgetActionID, // Action ID to show/hide the panel kMPOLnchPanelTitleKey, // Shows up in the Window list. "", // Alternate menu path of the form "Main:Foo" if you want your palette menu item in a second place @@ -385,7 +387,7 @@ resource MPOLnchPanelWidget(kSDKDefPanelResourceID + index_enUS) kMPOLnchPanelWidgetID, // WidgetID kPMRsrcID_None, // RsrcID kBindNone, // Binding (0=none) - 0, 0, 207, 95, // Frame: left, top, right, bottom. + 0, 0, 207, 200, // Frame: left, top, right, bottom. kTrue, kTrue, // Visible, Enabled kFalse, // Erase background kInterfacePaletteFill, // Erase to color @@ -408,7 +410,7 @@ resource MPOLnchPanelWidget(kSDKDefPanelResourceID + index_enUS) 20, // fVThumbScrollIncrement 0, // fHScrollButtonIncrement 0, // fHThumbScrollIncrement - 2, // Items selectable, 0 = No Selection, 1 = Single Selection, 2 = Multiple Selection + 1, // Items selectable, 0 = No Selection, 1 = Single Selection, 2 = Multiple Selection kFalse, // Allow children from multiple parents to be selected kTrue, // Allow discontiguous selection { @@ -427,18 +429,20 @@ resource MPOLnchNodeWidget (kMPOLnchListElementRsrcID + index_enUS) __FILE__, __LINE__, kMPOLnchListParentWidgetId, kPMRsrcID_None, // WidgetId, RsrcId kBindLeft | kBindRight, // Frame binding - Frame(0, 0, 194, 20), // Frame + Frame(0, 0, 194, 44), // Frame kTrue, kTrue, // Visible, Enabled "", // Panel name { + /* MPOLnchEyeballWidget ( kMPOLnchListElementEyeballWidgetID, kMPOLnchEyeBallIcon, kMPOLnchPluginID, // WidgetId, RsrcId kBindLeft, // Frame binding - Frame(3,1,22,18) // Frame + Frame(3,1,44,42) // Frame kTrue, kTrue, // Visible, Enabled kADBEIconSuiteButtonType, ), + MPOLnchPenWidget ( kMPOLnchListElementPenWidgetID, kMPOLnchPenIcon, kMPOLnchPluginID, // WidgetId, RsrcId @@ -447,13 +451,13 @@ resource MPOLnchNodeWidget (kMPOLnchListElementRsrcID + index_enUS) kTrue, kTrue, // Visible, Enabled kADBEIconSuiteButtonType, ), - + */ // Just a info-static text widget with about-box text view to get white bg. MPOLnchTextWidget ( kMPOLnchTextWidgetID, kPMRsrcID_None, // WidgetId, RsrcId kBindLeft | kBindRight, // Frame binding - Frame(45,1,194,18) // Frame + Frame(45,1,194,42) // Frame kTrue, kTrue, kAlignLeft,kEllipsizeEnd,kTrue, // Visible, Enabled, ellipsize style, convert ampersands "", // Initial text 0, // Associated widget for focus diff --git a/MPOLnchActionComponent.cpp b/MPOLnchActionComponent.cpp index 6c09512..c4bb71e 100644 --- a/MPOLnchActionComponent.cpp +++ b/MPOLnchActionComponent.cpp @@ -43,6 +43,9 @@ // Project includes: #include "MPOLnchID.h" +// file creation +#include "FileUtils.h" +#include "MPOLnchSciptsbuilder.cpp" /** MPOLnchActionComponent @@ -123,13 +126,13 @@ void MPOLnchActionComponent::DoAction(IActiveContext *myContext, ActionID action case kMPOLnchAddItemActionID: { - this->DoAddItem(widget); + //this->DoAddItem(widget); break; } case kMPOLnchRemoveItemActionID: { - this->DoRemoveItem(widget); + //this->DoRemoveItem(widget); break; } @@ -210,6 +213,7 @@ void MPOLnchActionComponent::DoAbout() */ void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget) { + /* InterfacePtr treeWidget(static_cast(Utils()->QueryRelatedWidget(invokedWidget, kMPOLnchListBoxWidgetID, IID_ICONTROLVIEW))); InterfacePtr treeMgr(treeWidget, UseDefaultIID()); InterfacePtr iListData(treeWidget, IID_ISTRINGLISTDATA); @@ -230,8 +234,25 @@ void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget) iListData->SetStringList(lists); //make sure that the node added has been processed NodeID node = MPOLnchNodeID::Create(item); + + //create a file in script the directory + IDFile file; + FileUtils::GetAppInstallationFolder(&file); + FileUtils::AppendPath(&file, PMString("Scripts")); + FileUtils::AppendPath(&file, PMString("Scripts Panel")); + PMString fn("newscriptfile"); + PMString ext(".jsx"); + + FileUtils::AppendPath(&file, fn + ext); + FileUtils::OpenFile(file, "wt"); + treeMgr->NodeAdded(node); } + */ + + // building the scripts + + } /* DoRemoveItem diff --git a/MPOLnchFactoryList.h b/MPOLnchFactoryList.h index 5a68179..ef1b00c 100644 --- a/MPOLnchFactoryList.h +++ b/MPOLnchFactoryList.h @@ -27,8 +27,8 @@ REGISTER_PMINTERFACE(MPOLnchActionComponent, kMPOLnchActionComponentImpl) REGISTER_PMINTERFACE(MPOLnchListBoxObserver, kMPOLnchListBoxObserverImpl) -REGISTER_PMINTERFACE(MPOLnchEyeballObserverImpl, kMPOLnchEyeballObserverImpl) -REGISTER_PMINTERFACE(MPOLnchPenObserverImpl, kMPOLnchPenObserverImpl) +//REGISTER_PMINTERFACE(MPOLnchEyeballObserverImpl, kMPOLnchEyeballObserverImpl) +//sREGISTER_PMINTERFACE(MPOLnchPenObserverImpl, kMPOLnchPenObserverImpl) REGISTER_PMINTERFACE(MPOLnchTreeViewAdapter, kMPOLnchTVHierarchyAdapterImpl) REGISTER_PMINTERFACE(MPOLnchTVWidgetMgr, kMPOLnchTVWidgetMgrImpl) diff --git a/MPOLnchListBoxObserver.cpp b/MPOLnchListBoxObserver.cpp index e28b61c..91a1835 100644 --- a/MPOLnchListBoxObserver.cpp +++ b/MPOLnchListBoxObserver.cpp @@ -38,6 +38,10 @@ #include "MPOLnchNodeID.h" #include "MPOLnchID.h" +// Scripting includes +#include "FileUtils.h" +#include "IScriptRunner.h" +#include "IScriptUtils.h" /** @@ -152,7 +156,7 @@ void MPOLnchListBoxObserver::Update const int kSelectionLength = selectedItems.size() ; if (kSelectionLength> 0 ) { - PMString dbgInfoString("Selected item(s): "); + PMString dbgInfoString(""); K2Vector::const_iterator iter, startIter, endIter; startIter = selectedItems.begin(); endIter = selectedItems.end(); @@ -162,11 +166,51 @@ void MPOLnchListBoxObserver::Update PMString item = oneNode->GetName(); item.Translate(); dbgInfoString.Append(item); - dbgInfoString += ", "; + //dbgInfoString += ", "; } - dbgInfoString.Truncate(2); //remove the last ', ' + + + //dbgInfoString.Truncate(2); //remove the last ', ' dbgInfoString.SetTranslatable(kFalse); // only for debug- not real code CAlert::InformationAlert(dbgInfoString); + + IDFile scriptFile; + + FileUtils::GetAppInstallationFolder(&scriptFile); //application folder path + FileUtils::AppendPath(&scriptFile, PMString("Scripts")); + FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel")); + PMString fn(dbgInfoString); + PMString ext(".jsx"); + + //inside the scripts panel, append path of the folder in which ur script is present. + //Suppose, ScriptsPanel->NewFolder->Link.jsx + //FileUtils::AppendPath(&scriptFile, PMString("NewFolder", -1, PMString::kNoTranslate)); + FileUtils::AppendPath(&scriptFile, fn + ext); + + //WideString scriptPath("myscript.jsx"); + //IDFile scriptFile(scriptPath); + try { + + + InterfacePtrscriptRunner(Utils()->QueryScriptRunner(scriptFile)); + bool filestatus=scriptRunner->CanHandleFile(scriptFile); + + RunScriptParams scriptParams(scriptRunner); + scriptParams.SetShowErrorAlert(kTrue); + scriptParams.SetInvokeDebugger(kFalse); + + + + if(filestatus==1) + { + scriptRunner->RunFile(scriptFile,scriptParams); + } + + } + catch (int e) { + CAlert::InformationAlert("Could not find the accioated scriptfile"); + } + } } while(0); diff --git a/MPOLnchNodeID.cpp b/MPOLnchNodeID.cpp index 9031d5f..ebee308 100644 --- a/MPOLnchNodeID.cpp +++ b/MPOLnchNodeID.cpp @@ -29,7 +29,7 @@ // Project includes: #include "MPOLnchNodeID.h" /** - @ingroup wlistboxcomposite + @ingroup mpolauncher */ /* Compare @@ -66,4 +66,14 @@ void MPOLnchNodeID::Write(IPMStream* stream) const (const_cast(this)->fName).ReadWrite(stream); } + + +/* SetName + */ +//void MPOLnchNodeID::SetName(const PMString& newName) +//{ +// if (fName != newName) +// fName = newName; +//} + // end, File: PnlTrvDataNode.cpp diff --git a/MPOLnchNodeID.h b/MPOLnchNodeID.h index a2e30f7..cb7f9be 100644 --- a/MPOLnchNodeID.h +++ b/MPOLnchNodeID.h @@ -93,13 +93,19 @@ class MPOLnchNodeID : public NodeIDClass const PMString& GetName() const { return fName; } + /** Set the Name Of the Node An Associated Javascript + @param PMString + */ + //virtual void SetName(const PMString& newName) = 0; + + private: // Note we're keeping the destructor private to force use of the factory methods MPOLnchNodeID() {} MPOLnchNodeID(PMString name):fName(name) {} + PMString fName; - PMString fName; }; #endif // __MPOLnchNodeID__ diff --git a/MPOLnch_enUS.fr b/MPOLnch_enUS.fr index d6eec56..8f62b73 100644 --- a/MPOLnch_enUS.fr +++ b/MPOLnch_enUS.fr @@ -40,7 +40,7 @@ resource StringTable (kSDKDefStringsResourceID + index_enUS) kMPOLnchCompanyKey, kMPOLnchCompanyValue, kMPOLnchAboutMenuKey, kMPOLnchPluginName "[US]...", kMPOLnchPluginsMenuKey, kMPOLnchPluginName "[US]", - kMPOLnchAddItemMenuItemKey, "Add item[US]", + kMPOLnchAddItemMenuItemKey, "Build Scripts [US]", kMPOLnchRemoveItemMenuItemKey, "Remove item[US]", kSDKDefAboutThisPlugInMenuKey, kSDKDefAboutThisPlugInMenuValue_enUS, @@ -51,27 +51,27 @@ resource StringTable (kSDKDefStringsResourceID + index_enUS) // ----- Panel/dialog strings - kMPOLnchPanelTitleKey, "WLB-Composite" "[US]",// irp was kMPOLnchPluginName "[US]", + kMPOLnchPanelTitleKey, "MPO Launcher" " [US]",// irp was kMPOLnchPluginName "[US]", // ----- Error strings // ----- Misc strings kMPOLnchAboutBoxStringKey, kMPOLnchPluginName "[US], version " kMPOLnchVersion " by " kMPOLnchAuthor "\n\n" kSDKDefCopyrightStandardValue "\n\n" kSDKDefPartnersStandardValue_enUS, // - kMPOLnchItemBaseKey "1", " Glasgow Celtic", - kMPOLnchItemBaseKey "2", " Hibernian", - kMPOLnchItemBaseKey "3", " Glasgow Rangers", - kMPOLnchItemBaseKey "4", " Kilmarnock", + kMPOLnchItemBaseKey "1", "scriptfile01", + kMPOLnchItemBaseKey "2", "scriptfile02", + kMPOLnchItemBaseKey "3", "scriptfile03", + kMPOLnchItemBaseKey "4", "scriptfile04", - kMPOLnchItemBaseKey "5", " Heart of Midlothian", - kMPOLnchItemBaseKey "6", " Dunfermline Athletic", - kMPOLnchItemBaseKey "7", " Motherwell", - kMPOLnchItemBaseKey "8", " St. Johnstone", + kMPOLnchItemBaseKey "5", "scriptfile05", + kMPOLnchItemBaseKey "6", "scriptfile06", + kMPOLnchItemBaseKey "7", "scriptfile07", + kMPOLnchItemBaseKey "8", "scriptfile08", - kMPOLnchItemBaseKey "9", " Dundee", - kMPOLnchItemBaseKey "10", " Aberdeen", - kMPOLnchItemBaseKey "11", " Dundee United", - kMPOLnchItemBaseKey "12", " St. Mirren", + kMPOLnchItemBaseKey "9", "scriptfile09", + kMPOLnchItemBaseKey "10", "scriptfile10", + kMPOLnchItemBaseKey "11", "scriptfile11", + kMPOLnchItemBaseKey "12", "scriptfile12", kMPOLnchAddedElementKey, " + Added Element", } diff --git a/mpolnchicopng.fr b/mpolnchicopng.fr new file mode 100644 index 0000000..0e9c530 --- /dev/null +++ b/mpolnchicopng.fr @@ -0,0 +1,34 @@ +//======================================================================================== +// +// $File: //depot/indesign_6.0/highprofile/source/sdksamples/pictureicon/picicopng.fr $ +// +// Owner: Adobe Developer Technologies +// +// $Author: pmbuilder $ +// +// $DateTime: 2008/08/19 04:03:07 $ +// +// $Revision: #1 $ +// +// $Change: 643572 $ +// +// Copyright 1997-2008 Adobe Systems Incorporated. All rights reserved. +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance +// with the terms of the Adobe license agreement accompanying it. If you have received +// this file from a source other than Adobe, then your use, modification, or +// distribution of it requires the prior written permission of Adobe. +// +// +// Identifies PNG resources used by the PicIco plug-in. +// +//======================================================================================== + +#ifdef __ODFRC__ + +#include "MPOLnchID.h" + +resource PNGA(kPicIcoPNGIconRsrcID) "Iconic.png" +resource PNGR(kPicIcoPNGIconRollRsrcID) "IconicR.png" + +#endif \ No newline at end of file diff --git a/scriptfile01.jsx b/scriptfile01.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile01.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile02.jsx b/scriptfile02.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile02.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile03.jsx b/scriptfile03.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile03.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile04.jsx b/scriptfile04.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile04.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile05.jsx b/scriptfile05.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile05.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile06.jsx b/scriptfile06.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile06.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile07.jsx b/scriptfile07.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile07.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile08.jsx b/scriptfile08.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile08.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile09.jsx b/scriptfile09.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile09.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile10.jsx b/scriptfile10.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile10.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile11.jsx b/scriptfile11.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile11.jsx @@ -0,0 +1 @@ +alert($.fileName); diff --git a/scriptfile12.jsx b/scriptfile12.jsx new file mode 100644 index 0000000..639423d --- /dev/null +++ b/scriptfile12.jsx @@ -0,0 +1 @@ +alert($.fileName);