Skip to content

Commit

Permalink
before building files
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Jul 2, 2011
1 parent 47f43c1 commit ffcfc51
Show file tree
Hide file tree
Showing 20 changed files with 167 additions and 36 deletions.
30 changes: 17 additions & 13 deletions MPOLnch.fr
Original file line number Diff line number Diff line change
@@ -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
//
Expand Down Expand Up @@ -51,6 +51,8 @@
#include "AboutBoxID.h" // for kAboutBoxStaticTextViewImpl
#include "TreeViewDefs.h"



// Project includes:
#include "MPOLnchID.h"
#include "MPOLnchRezDefs.h"
Expand Down Expand Up @@ -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
{
Expand All @@ -98,7 +100,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID)

/**
Controls addition of a pop-up menu to the panel.
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/
Class
{
Expand All @@ -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
{
Expand Down Expand Up @@ -150,7 +152,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID)

/**
Adds observer to the 'eyeball' button.
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/
Class
{
Expand All @@ -166,7 +168,7 @@ resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID)

/**
Adds observer to the 'Pen' button
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/
Class
{
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -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
Expand All @@ -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
Expand Down
25 changes: 23 additions & 2 deletions MPOLnchActionComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@

// Project includes:
#include "MPOLnchID.h"
// file creation
#include "FileUtils.h"
#include "MPOLnchSciptsbuilder.cpp"


/** MPOLnchActionComponent
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -210,6 +213,7 @@ void MPOLnchActionComponent::DoAbout()
*/
void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget)
{
/*
InterfacePtr<IControlView> treeWidget(static_cast<IControlView*>(Utils<IWidgetUtils>()->QueryRelatedWidget(invokedWidget, kMPOLnchListBoxWidgetID, IID_ICONTROLVIEW)));
InterfacePtr<ITreeViewMgr> treeMgr(treeWidget, UseDefaultIID());
InterfacePtr<IStringListData> iListData(treeWidget, IID_ISTRINGLISTDATA);
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions MPOLnchFactoryList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
50 changes: 47 additions & 3 deletions MPOLnchListBoxObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include "MPOLnchNodeID.h"
#include "MPOLnchID.h"

// Scripting includes
#include "FileUtils.h"
#include "IScriptRunner.h"
#include "IScriptUtils.h"

/**
Expand Down Expand Up @@ -152,7 +156,7 @@ void MPOLnchListBoxObserver::Update
const int kSelectionLength = selectedItems.size() ;
if (kSelectionLength> 0 )
{
PMString dbgInfoString("Selected item(s): ");
PMString dbgInfoString("");
K2Vector<NodeID>::const_iterator iter, startIter, endIter;
startIter = selectedItems.begin();
endIter = selectedItems.end();
Expand All @@ -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 {


InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->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);
Expand Down
12 changes: 11 additions & 1 deletion MPOLnchNodeID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// Project includes:
#include "MPOLnchNodeID.h"
/**
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/

/* Compare
Expand Down Expand Up @@ -66,4 +66,14 @@ void MPOLnchNodeID::Write(IPMStream* stream) const
(const_cast<MPOLnchNodeID*>(this)->fName).ReadWrite(stream);
}



/* SetName
*/
//void MPOLnchNodeID::SetName(const PMString& newName)
//{
// if (fName != newName)
// fName = newName;
//}

// end, File: PnlTrvDataNode.cpp
8 changes: 7 additions & 1 deletion MPOLnchNodeID.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
28 changes: 14 additions & 14 deletions MPOLnch_enUS.fr
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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",
}

Expand Down
Loading

0 comments on commit ffcfc51

Please sign in to comment.