Skip to content

Commit

Permalink
last version of plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Sep 26, 2011
1 parent 5fc24fe commit 79d15bb
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 32 deletions.
Binary file modified .DS_Store
Binary file not shown.
91 changes: 87 additions & 4 deletions MPOLnchActionComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "ITreeViewMgr.h"
#include "ITreeViewHierarchyAdapter.h"
#include "IStringListData.h"
//#include "IPnlTrvDataModel.h"


// General includes:
#include "CActionComponent.h"
Expand All @@ -47,7 +49,7 @@
#include "FileUtils.h"
#include "CoreFileUtils.h"
#include "StreamUtil.h"

#include "SDKFileHelper.h"
#include "MPOLnchHelper.h"


Expand Down Expand Up @@ -102,11 +104,22 @@ class MPOLnchActionComponent : public CActionComponent
/** Encapsulates functionality for the restore fc queries menu item. */

void ShowFC();


/** Encapsulates functionality for the SetOptions menu item. */
void handleSetOptions();


/** Encapsulates functionality for the Refresh menu item. */
void handleRefresh();

/** Encapsulates functionality for the AddItem menu item.
@param invokedWidget Widget that initiated the event (the panel menu), useful for getting the panel & other widgets.
*/
void DoAddItem(IPMUnknown *invokedWidget);


void DoRestoreScripts(IPMUnknown *invokedWidget);



Expand Down Expand Up @@ -147,7 +160,7 @@ void MPOLnchActionComponent::DoAction(IActiveContext *myContext, ActionID action

case kMPOLnchAddItemActionID:
{
this->DoAddItem(widget);
this->DoRestoreScripts(widget);
break;
}
case kMPOLnchFCQueriesActionID:
Expand Down Expand Up @@ -292,7 +305,7 @@ void MPOLnchActionComponent::ShowFC()

/* DoAddItem
*/
void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget)
void MPOLnchActionComponent::DoRestoreScripts(IPMUnknown *invokedWidget)
{
// building the scripts

Expand All @@ -303,6 +316,40 @@ void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget)
}


/* handleSetOptions
*/
void MPOLnchActionComponent::handleSetOptions()
{
do
{
const int32 cCountOfOptions = 1;
K2Vector<PMString> optionsVec(cCountOfOptions);
PMString assetPathTitle("Select a folder", PMString::kTranslateDuringCall);
assetPathTitle.SetTranslatable(kFalse);
SDKFolderChooser folderChooser;
folderChooser.SetTitle(assetPathTitle);
folderChooser.ShowDialog();
if(!folderChooser.IsChosen())
{
break;
}

PMString folder = folderChooser.GetPath();
if(folder.empty() == kTrue)
{
break;
}
optionsVec.push_back(folder);
if(folder.empty() == kFalse)
{
// this->processSetOptionsCommand(optionsVec);
this->handleRefresh();
}
} while(kFalse);

}



/* DoRemoveItem
*/
Expand Down Expand Up @@ -342,6 +389,42 @@ void MPOLnchActionComponent::DoRemoveItem(IPMUnknown *invokedWidget)

}

/* handleRefresh
*/
void MPOLnchActionComponent::handleRefresh()
{
do
{
IControlView* treeWidget = MPOLnchHelper::GetWidgetOnPanel(
kMPOLnchPanelWidgetID, kMPOLnchListBoxWidgetID);
ASSERT(treeWidget);
if(!treeWidget) {
break;
}

// InterfacePtr<IPnlTrvDataModel> model(treeWidget, UseDefaultIID());
// ASSERT(model);
// if(!model) {
// break;
// }
// PMString folderRootPath = PnlTrvUtils::GetFolderSelectedPath();
// if(folderRootPath.empty()) {
// break;
// }
// model->Rebuild(folderRootPath);
// InterfacePtr<ITreeViewMgr>
// iTreeViewMgr(treeWidget, UseDefaultIID());
// ASSERT(iTreeViewMgr);
// if(!iTreeViewMgr){
// break;
// }
//
//
// iTreeViewMgr->ClearTree();
// iTreeViewMgr->ChangeRoot(kTrue);

} while(kFalse);
}


// End, MPOLnchActionComponent.cpp.
Expand Down
130 changes: 103 additions & 27 deletions MPOLnchHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MPOLnchHelper::MPOLnchHelper(){
}
int MPOLnchHelper::MAXITEMS = 13;
int MPOLnchHelper::METAMAXITEMS = 3;
int MPOLnchHelper::FCGREPMAXITEMS = 19;
int MPOLnchHelper::FCGREPMAXITEMS = 68;
int MPOLnchHelper::FCOBJECTMAXITEMS = 1;
int MPOLnchHelper::FCTEXTMAXITEMS = 1;
int MPOLnchHelper::MISCMAXITEMS = 5;
Expand Down Expand Up @@ -138,32 +138,81 @@ PMString MPOLnchHelper::GetObjectFCFile(int i){

PMString MPOLnchHelper::GetGrepFCFile(int i){

PMString theFileName[19] = {

"__JMRaute 2 Raute whitespace.xml",
"JM__ANAB_01.xml",
"JM__ANAB_02.xml",
"JM__APOSTROPH.xml",
"JM__BISSTRICH.xml",
"JM__EURO_hin.xml",
"JM__EURO_zurueck.xml",
"JM__INTERPUNKTION.xml",
"JM__KOMMABLANK.xml",
"JM__LEERZEICHEN_DOPPELTE.xml",
"JM__MALZEICHEN.xml",
"JM__PREISSTRICH.xml",
"JM__PUNKTBLANK.xml",
"JM__ZOLL_HIN.xml",
"JM__ZOLL_ZURUECK.xml",
"JM__ZOLLZEICHEN.xml",
"JM_MIDI.xml",
"JM_Plug-in.xml",
"mySpecsFinder.xml"};



if (i > 19) {
i = 19;
PMString theFileName[68] = {

"JM_NEU_SAVE_0_d_blank_zoll.xml",
"JM_NEU_SAVE_0a_Anfuehrungen_I_hin.xml",
"JM_NEU_SAVE_0b_Anfuehrungen_II_hin.xml",
"JM_NEU_SAVE_0c_ABFUEHRUNGEN.xml",
"JM_NEU_SAVE_0d_AN_AB_ersetzen.xml",
"JM_NEU_SAVE_0e_ABFUEHRUNGEN.xml",
"JM_NEU_SAVE_0f_AN_AB_ersetzen.xml",
"JM_NEU_SAVE_0g_AN_AB_ersetzen.xml",
"JM_NEU_SAVE_0h_Anab_in_Anab.xml",
"JM_NEU_SAVE_1e_Zoll.xml",
"JM_NEU_SAVE_2_aufzaehlungen.xml",
"JM_NEU_SAVE_2b_ellipse.xml",
"JM_NEU_SAVE_3a_blank_ellipse.xml",
"JM_NEU_SAVE_3b_ellipse_blank.xml",
"JM_NEU_SAVE_4a_blank_mm.xml",
"JM_NEU_SAVE_4b_blank_cm.xml",
"JM_NEU_SAVE_4d_blank_interpunktion.xml",
"JM_NEU_SAVE_4e_komma_blank.xml",
"JM_NEU_SAVE_4f_punkt_blank.xml",
"JM_NEU_SAVE_4g_blank_ausrufezeichen.xml",
"JM_NEU_SAVE_4h_blank_doppelpunkt.xml",
"JM_NEU_SAVE_4i_blank_semikolon.xml",
"JM_NEU_SAVE_4j_klammern_blank.xml",
"JM_NEU_SAVE_4k_klammern_punct.xml",
"JM_NEU_SAVE_4l_klammern_umbruch.xml",
"JM_NEU_SAVE_4m_slash_blanks.xml",
"JM_NEU_SAVE_5a_zoll_blank.xml",
"JM_NEU_SAVE_5b_malzeichen_I_nach_zoll.xml",
"JM_NEU_SAVE_5c_malzeichen_breite_hoehe_tiefe.xml",
"JM_NEU_SAVE_5c1_malzeichen_breite_hoehe_tiefe_in_zahlen.xml",
"JM_NEU_SAVE_5d_malzeichen_dxddzoll.xml",
"JM_NEU_SAVE_5e_malzeichen_sdx.xml",
"JM_NEU_SAVE_5f_malzeichen_sdx.xml",
"JM_NEU_SAVE_6_Gedankenstrich.xml",
"JM_NEU_SAVE_7_kHz.xml",
"JM_NEU_SAVE_8a_X_teilig.xml",
"JM_NEU_SAVE_8b_X_fach.xml",
"JM_NEU_SAVE_9a_z_B.xml",
"JM_NEU_SAVE_9b_aaO.xml",
"JM_NEU_SAVE_9c_dh.xml",
"JM_NEU_SAVE_9d_mE.xml",
"JM_NEU_SAVE_9e_oae.xml",
"JM_NEU_SAVE_9f_so.xml",
"JM_NEU_SAVE_9g_su.xml",
"JM_NEU_SAVE_9h_ua.xml",
"JM_NEU_SAVE_9i_uU.xml",
"JM_NEU_SAVE_9j_va.xml",
"JM_NEU_SAVE_9k_zH.xml",
"JM_NEU_SAVE_9l_zT.xml",
"JM_NEU_SAVE_10a_seitenzahl.xml",
"JM_NEU_SAVE_10b_seitenzahl_1_24stel.xml",
"JM_NEU_SAVE_13_Apostroph.xml",
"JM_NEU_SAVE_14c_Preisstrich.xml",
"JM_NEU_SAVE_15a_Plugin.xml",
"JM_NEU_SAVE_15b_Midi.xml",
"JM_NEU_SAVE_15c_specs.xml",
"JM_NEU_SAVE_15d_Features.xml",
"JM_NEU_SAVE_16_Bisstrich_Ziffern.xml",
"JM_NEU_SAVE_17a_Beschreibung_Marke.xml",
"JM_NEU_SAVE_17a1_Beschreibung_Marke.xml",
"JM_NEU_SAVE_17b_aufzaehlung_ranziehen.xml",
"JM_NEU_SAVE_17c_textflussende_ranziehen.xml",
"JM_NEU_SAVE_18_doubleblanks.xml",
"JM_NEU_SAVE_19a_Euro_hin.xml",
"JM_NEU_SAVE_19b_Euro_zurueck.xml",
"JM_NEU_SAVE_20a_gfL.xml",
"JM_NEU_SAVE_20b_gfL.xml",
"JM_FUSS_FIXER.xml"};



if (i > 68) {
i = 68;
}
return theFileName[i];
}
Expand Down Expand Up @@ -483,3 +532,30 @@ void MPOLnchHelper::RestoreMPOLnchScrpts(){
CAlert::InformationAlert("Copied the missing files");

}

/* GetWidgetOnPanel
*/
IControlView* MPOLnchHelper::GetWidgetOnPanel(
const WidgetID& panelWidgetID, const WidgetID& widgetID)
{
IControlView* controlView=nil;
do
{
InterfacePtr<IPanelControlData>
panelData(Utils<IPalettePanelUtils>()->QueryPanelByWidgetID(panelWidgetID));
// Don't assert, fail silently, the tree view panel may be closed.
if(panelData == nil)
{
break;
}
controlView = panelData->FindWidget(widgetID);
ASSERT(controlView);
if(controlView == nil)
{
break;
}
} while(0);

return controlView;
}

13 changes: 12 additions & 1 deletion MPOLnchHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
#include "FileUtils.h"
#include "CAlert.h"
#include "StreamUtil.h"

#include "ITreeViewController.h"
#include "IPanelControlData.h"
#include "Utils.h"
#include "IPalettePanelUtils.h"


class MPOLnchHelper
Expand Down Expand Up @@ -53,6 +56,14 @@ class MPOLnchHelper
PMString MissingScrptFileStr(PMString fn); // Error warning
PMString MissingHelpFileStr(PMString fn); // Error warning

/** Get a widget from the specified panel by WidgetID, returning nil if it can't be found.
@param panelWidgetID [IN] specifies the parent widget
@param widgetID [IN] sought dependent widget
@return interface ptr to widget found or nil if it can't be found; not a reference incremented one though.
*/
static IControlView* GetWidgetOnPanel(
const WidgetID& panelWidgetID, const WidgetID& widgetID);


private:

Expand Down

0 comments on commit 79d15bb

Please sign in to comment.