From b2659f1f5e282e13024e9ca184dd8d18c94d5ca1 Mon Sep 17 00:00:00 2001 From: fabiantheblind Date: Tue, 26 Jul 2011 15:48:53 +0200 Subject: [PATCH] running version --- .DS_Store | Bin 0 -> 6148 bytes MPOLnch.fr | 4 +- MPOLnchActionComponent.cpp | 154 ++++++++++++++++++++++++++++++++++- MPOLnchID.h | 1 + MPOLnchListBoxObserver.cpp | 35 ++++---- MPOLnchTreeViewWidgetMgr.cpp | 2 +- MPOLnch_enUS.fr | 24 +++--- WLBCmpMacRez.rsrc | 0 mpolnchicopng.fr | 34 -------- plugin.sdk.xcconfig | 64 --------------- plugin_debug.xcconfig | 6 -- plugin_release.xcconfig | 8 -- 12 files changed, 183 insertions(+), 149 deletions(-) create mode 100644 .DS_Store create mode 100644 WLBCmpMacRez.rsrc delete mode 100644 mpolnchicopng.fr delete mode 100644 plugin.sdk.xcconfig delete mode 100644 plugin_debug.xcconfig delete mode 100644 plugin_release.xcconfig diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 +#include +#include /** MPOLnchActionComponent @@ -88,6 +92,13 @@ class MPOLnchActionComponent : public CActionComponent @param invokedWidget Widget that initiated the event (the panel menu), useful for getting the panel & other widgets. */ void DoAddItem(IPMUnknown *invokedWidget); + + + /* My personal copyFile + * until i get FileUtils::CopyFile() to work + */ + // bool copyFile (const char SRC[], const char DEST[]); + /** Encapsulates functionality for the RemoveItem menu item. @@ -126,13 +137,15 @@ void MPOLnchActionComponent::DoAction(IActiveContext *myContext, ActionID action case kMPOLnchAddItemActionID: { - //this->DoAddItem(widget); + this->DoAddItem(widget); break; } case kMPOLnchRemoveItemActionID: { //this->DoRemoveItem(widget); + CAlert::InformationAlert("This optin doesn't work right now. Sry"); + break; } @@ -252,9 +265,146 @@ void MPOLnchActionComponent::DoAddItem(IPMUnknown *invokedWidget) // building the scripts + + + using namespace std; + + const int MAXITEMS = 12; + + PMString scriptfiles[MAXITEMS] = { + "scriptfile01.jsx", + "scriptfile02.jsx", + "scriptfile03.jsx", + "scriptfile04.jsx", + "scriptfile05.jsx", + "scriptfile06.jsx", + "scriptfile07.jsx", + "scriptfile08.jsx", + "scriptfile09.jsx", + "scriptfile10.jsx", + "scriptfile11.jsx", + "scriptfile12.jsx"}; + + PMString newscriptfiles[MAXITEMS] = { + "newscriptfile01.jsx", + "newscriptfile02.jsx", + "newscriptfile03.jsx", + "newscriptfile04.jsx", + "newscriptfile05.jsx", + "newscriptfile06.jsx", + "newscriptfile07.jsx", + "newscriptfile08.jsx", + "newscriptfile09.jsx", + "newscriptfile10.jsx", + "newscriptfile11.jsx", + "newscriptfile12.jsx"}; + + //string source = "incoming.txt"; + //string clone = "outgoing.txt"; + + // cout << "Enter the source file: "; + // cin >> source; + // cout << "Enter the name of the new file: "; + // cin >> clone; + + for (int i = 0; i < MAXITEMS ; i++) { + + + IDFile theSource;//scriptfiles[i]; + + FileUtils::GetAppInstallationFolder(&theSource); + FileUtils::AppendPath(&theSource, PMString("Plug-Ins")); + FileUtils::AppendPath(&theSource, PMString("tmn")); + FileUtils::AppendPath(&theSource, PMString("MPOLauncher.InDesignPlugin")); +// + FileUtils::AppendPath(&theSource, PMString("Versions")); + FileUtils::AppendPath(&theSource, PMString("A")); + FileUtils::AppendPath(&theSource, PMString("Resources")); + FileUtils::AppendPath(&theSource, PMString(scriptfiles[i])); + + PMString sourceFileStringUrl = FileUtils::SysFileToFileURL(theSource); + + if(!FileUtils::DoesFileExist(theSource)){ + CAlert::InformationAlert(" could not find the Source File. I am Here-> " + sourceFileStringUrl + +"\n"+ + " Please report this bug to: fabiantheblind@the-moron.net"); + break; + } + + + + + IDFile theTarget; + FileUtils::GetAppInstallationFolder(&theTarget); + FileUtils::AppendPath(&theTarget, PMString("Scripts")); + FileUtils::AppendPath(&theTarget, PMString("Scripts Panel")); + FileUtils::AppendPath(&theTarget, PMString("MPO Launcher")); + + FileUtils::CreateFolderIfNeeded(theTarget,kTrue); + + PMString fn(newscriptfiles[i]); + + FileUtils::AppendPath(&theTarget, fn); + + //FileUtils::OpenFile(theTarget, "w"); + if(!FileUtils::DoesFileExist(theTarget)){ + + CAlert::InformationAlert("I will try to copy "+fn+ " to the folder: Scripts Panel/MPO Launcher"); + + if(!FileUtils::CopyFile(theSource, theTarget)){ + + CAlert::InformationAlert("Could not copy "+fn+". Sorry"); + + + } + } + + // PMString sourceFileStringUrl = FileUtils::SysFileToFileURL(theSource); +// string sfurl = sourceFileStringUrl.GrabCString(); +// +// PMString targetFileStringUrl = FileUtils::SysFileToFileURL(theTarget); +// string tfurl = targetFileStringUrl.GrabCString(); +// +// std::ifstream src; // the source file +// std::ofstream dest; // the destination file +// +// src.open (sfurl.c_str(), std::ios::binary); // open in binary to prevent jargon at the end of the buffer +// dest.open (tfurl.c_str(), std::ios::binary); // same again, binary +// if (src.is_open() && dest.is_open()) +// { +// dest << src.rdbuf (); // copy the content +// dest.close (); // close destination file +// src.close (); // close source file + } + + // if(!copyFile(sfurl.c_str(),tfurl.c_str())){ +// +// CAlert::InformationAlert("Could not copy the scriptfiles. Sorry"); +// +// } + + //FileUtils::CopyFile(theSource, theTarget); + //FileUtils::OpenFile(file, "wt"); + + //PMString sourcefile = FileUtils::SysFileToFileURL(theSource); +// PMString targetfile = FileUtils::SysFileToFileURL(theTarget); +// ifstream in(sourcefile.GetPlatformString().c_str()); // Open for reading +// ofstream out( targetfile.GetPlatformString().c_str()); // Open for writing +// +// //printf("wrote file newscriptfile with number %do to disc\n",i); +// string s; +// while(getline(in, s)) +// out << s << "\n"; + //in->Close(); + //out->Close(); + + //} + + } + /* DoRemoveItem */ void MPOLnchActionComponent::DoRemoveItem(IPMUnknown *invokedWidget) diff --git a/MPOLnchID.h b/MPOLnchID.h index 3a6cc6c..3fd6830 100644 --- a/MPOLnchID.h +++ b/MPOLnchID.h @@ -105,6 +105,7 @@ DECLARE_PMID(kWidgetIDSpace, kMPOLnchListElementPenWidgetID, kMPOLnchPrefix + 5) + // Menu item positions: #define kMPOLnchAddItemMenuItemPosition 1.0 #define kMPOLnchRemoveItemMenuItemPosition 2.0 diff --git a/MPOLnchListBoxObserver.cpp b/MPOLnchListBoxObserver.cpp index 91a1835..ef9b22e 100644 --- a/MPOLnchListBoxObserver.cpp +++ b/MPOLnchListBoxObserver.cpp @@ -156,7 +156,7 @@ void MPOLnchListBoxObserver::Update const int kSelectionLength = selectedItems.size() ; if (kSelectionLength> 0 ) { - PMString dbgInfoString(""); + PMString nodeName(""); K2Vector::const_iterator iter, startIter, endIter; startIter = selectedItems.begin(); endIter = selectedItems.end(); @@ -165,32 +165,28 @@ void MPOLnchListBoxObserver::Update const MPOLnchNodeID* oneNode = static_cast(iter->Get()); PMString item = oneNode->GetName(); item.Translate(); - dbgInfoString.Append(item); + nodeName.Append(item); //dbgInfoString += ", "; } //dbgInfoString.Truncate(2); //remove the last ', ' - dbgInfoString.SetTranslatable(kFalse); // only for debug- not real code - CAlert::InformationAlert(dbgInfoString); + nodeName.SetTranslatable(kFalse); // only for debug- not real code + CAlert::InformationAlert(nodeName); 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"); + FileUtils::AppendPath(&scriptFile, PMString("MPO Launcher")); + if (FileUtils::DoesFileExist(scriptFile)) { - //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); + PMString fn(nodeName); + PMString ext(".jsx"); - //WideString scriptPath("myscript.jsx"); - //IDFile scriptFile(scriptPath); - try { + FileUtils::AppendPath(&scriptFile, fn + ext); InterfacePtrscriptRunner(Utils()->QueryScriptRunner(scriptFile)); bool filestatus=scriptRunner->CanHandleFile(scriptFile); @@ -202,16 +198,15 @@ void MPOLnchListBoxObserver::Update if(filestatus==1) - { + { scriptRunner->RunFile(scriptFile,scriptParams); - } - - } - catch (int e) { - CAlert::InformationAlert("Could not find the accioated scriptfile"); + }// close filestatus + }else { + CAlert::InformationAlert("Got an error. You need the MPO Launcher Folder in the Scripts Panel"); } - } + + } } while(0); } diff --git a/MPOLnchTreeViewWidgetMgr.cpp b/MPOLnchTreeViewWidgetMgr.cpp index afa3ff7..538a903 100644 --- a/MPOLnchTreeViewWidgetMgr.cpp +++ b/MPOLnchTreeViewWidgetMgr.cpp @@ -36,7 +36,7 @@ /** * Tree view manager - @ingroup wlistboxcomposite + @ingroup mpolauncher */ class MPOLnchTVWidgetMgr : public CTreeViewWidgetMgr { diff --git a/MPOLnch_enUS.fr b/MPOLnch_enUS.fr index 8f62b73..21fd4e8 100644 --- a/MPOLnch_enUS.fr +++ b/MPOLnch_enUS.fr @@ -58,20 +58,20 @@ resource StringTable (kSDKDefStringsResourceID + index_enUS) // ----- Misc strings kMPOLnchAboutBoxStringKey, kMPOLnchPluginName "[US], version " kMPOLnchVersion " by " kMPOLnchAuthor "\n\n" kSDKDefCopyrightStandardValue "\n\n" kSDKDefPartnersStandardValue_enUS, // - kMPOLnchItemBaseKey "1", "scriptfile01", - kMPOLnchItemBaseKey "2", "scriptfile02", - kMPOLnchItemBaseKey "3", "scriptfile03", - kMPOLnchItemBaseKey "4", "scriptfile04", + kMPOLnchItemBaseKey "1", "newscriptfile01", + kMPOLnchItemBaseKey "2", "newscriptfile02", + kMPOLnchItemBaseKey "3", "newscriptfile03", + kMPOLnchItemBaseKey "4", "newscriptfile04", - kMPOLnchItemBaseKey "5", "scriptfile05", - kMPOLnchItemBaseKey "6", "scriptfile06", - kMPOLnchItemBaseKey "7", "scriptfile07", - kMPOLnchItemBaseKey "8", "scriptfile08", + kMPOLnchItemBaseKey "5", "newscriptfile05", + kMPOLnchItemBaseKey "6", "newscriptfile06", + kMPOLnchItemBaseKey "7", "newscriptfile07", + kMPOLnchItemBaseKey "8", "newscriptfile08", - kMPOLnchItemBaseKey "9", "scriptfile09", - kMPOLnchItemBaseKey "10", "scriptfile10", - kMPOLnchItemBaseKey "11", "scriptfile11", - kMPOLnchItemBaseKey "12", "scriptfile12", + kMPOLnchItemBaseKey "9", "newscriptfile09", + kMPOLnchItemBaseKey "10", "newscriptfile10", + kMPOLnchItemBaseKey "11", "newscriptfile11", + kMPOLnchItemBaseKey "12", "newscriptfile12", kMPOLnchAddedElementKey, " + Added Element", } diff --git a/WLBCmpMacRez.rsrc b/WLBCmpMacRez.rsrc new file mode 100644 index 0000000..e69de29 diff --git a/mpolnchicopng.fr b/mpolnchicopng.fr deleted file mode 100644 index 0e9c530..0000000 --- a/mpolnchicopng.fr +++ /dev/null @@ -1,34 +0,0 @@ -//======================================================================================== -// -// $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/plugin.sdk.xcconfig b/plugin.sdk.xcconfig deleted file mode 100644 index 2753ccb..0000000 --- a/plugin.sdk.xcconfig +++ /dev/null @@ -1,64 +0,0 @@ -ALWAYS_REZ = YES -ARCHS = $(NATIVE_ARCH) -BIB_THROW = BIB_NO_THROW -BUILT_APPLICATION_DIR = ../$(TARGET_NAME)/packagefolder/contents/macos/ -CONFIGURATION_BUILD_DIR = $(BUILT_PRODUCTS_DIR) -DEBUG_INFORMATION_FORMAT = dwarf -GCC_ENABLE_CPP_EXCEPTIONS = NO -GCC_ENABLE_CPP_RTTI = YES -GCC_ENABLE_SYMBOL_SEPARATION = YES -GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES -GCC_INLINES_ARE_PRIVATE_EXTERN = YES -GCC_INPUT_FILETYPE = sourcecode.cpp.cpp -GCC_PRECOMPILE_PREFIX_HEADER = YES -GCC_PREFIX_HEADER = ../../../source/precomp/gcc/PluginPrefix.pch -GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) MACINTOSH $(BIB_THROW) -GCC_SYMBOLS_PRIVATE_EXTERN = YES -GCC_THREADSAFE_STATICS = NO -GCC_TREAT_WARNINGS_AS_ERRORS = YES -GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO -GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES -GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES -GCC_WARN_INHIBIT_ALL_WARNINGS = NO -GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_NON_VIRTUAL_DESTRUCTOR = NO -GCC_WARN_SHADOW = YES -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_LABEL = YES -GCC_WARN_UNUSED_PARAMETER = NO -GCC_WARN_UNUSED_VALUE = YES -GCC_WARN_UNUSED_VARIABLE = NO -HEADER_SEARCH_PATHS = /Developer/Headers/FlatCarbon ../../../external/asl/boost_libraries/ ../../../external/afl/includes ../../../source/precomp/common ../../../source/precomp/msvc ../../../source/public/includes ../../../source/public/interfaces/architecture ../../../source/public/includes/utils ../../../source/public/interfaces/utils ../../../source/public/interfaces/xmedia ../../../source/public/libs/widgetbin/includes -IC_CREATOR = "InCp" -ID_APPLICATION_TYPE = "APPL" -ID_CREATOR = "InDn" -ID_DIR = $(SRCROOT)/../$(TARGET_NAME) -ID_FUTURE_VERSION_DIR = $(SRCROOT)/../$(TARGET_NAME)/packagefolder/contents/macos/future version -ID_PLUGIN_OPTIONAL_TYPE = "InDa" -ID_PLUGIN_REQUIRED_TYPE = "InDr" -ID_PLUGIN_SDK_TYPE = "InD3" -ID_PLUGINS_DIR = $(SRCROOT)/../$(TARGET_NAME)/plug-ins -ID_REQUIRED_DIR = $(SRCROOT)/../$(TARGET_NAME)/packagefolder/contents/macos/required -ID_SDK_DIR = $(SRCROOT)/../$(TARGET_NAME)/SDK -ID_TESTING_DIR = $(SRCROOT)/../$(TARGET_NAME)/packagefolder/contents/macos/testing -INSTALL_PATH = ./ -MACOSX_DEPLOYMENT_TARGET_i386 = 10.4 -MACOSX_DEPLOYMENT_TARGET_ppc = 10.4 -ONLY_LINK_ESSENTIAL_SYMBOLS = YES -OTHER_LDFLAGS = -Wl,-executable_path -Wl,$(BUILT_APPLICATION_DIR) -PER_ARCH_CFLAGS_i386 = -DMACTEL_SKIP -PLC_GENERATE_PKGINFO_FILE = YES -PLC_INCLUDES = $(REZ_SEARCH_PATHS) -PLC_OUTPUT_CREATOR = InDn -PLC_OUTPUT_TYPE = ???? -PREBINDING = NO -REZ_SEARCH_PATHS = ../../../external/palettes ../../../external/workflow icons -SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES -SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk -SHARED_PRECOMPS_DIR = build/SharedPrecompiledHeaders/$(TARGET_NAME) -TARGET_BUILD_DIR = $(BUILT_PRODUCTS_DIR) -WARNING_CFLAGS = -Wchar-subscripts -Wimplicit -Wsequence-point -Winit-self -Wmissing-field-initializers -Wpointer-arith -Wcast-align -Wpacked -WRAPPER_EXTENSION = InDesignPlugin - diff --git a/plugin_debug.xcconfig b/plugin_debug.xcconfig deleted file mode 100644 index e744dd4..0000000 --- a/plugin_debug.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS) ../debug/packagefolder/contents/macos ../debug/packagefolder/contents/Frameworks -GCC_GENERATE_DEBUGGING_SYMBOLS = YES -GCC_OPTIMIZATION_LEVEL = 0 -GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) DEBUG -LIBRARY_SEARCH_PATHS = $(LIBRARY_SEARCH_PATHS) ../debug/packagefolder/contents/macos/libs -OTHER_REZFLAGS = -d __GNUC__ -d DEBUG -d MACINTOSH diff --git a/plugin_release.xcconfig b/plugin_release.xcconfig deleted file mode 100644 index 578a492..0000000 --- a/plugin_release.xcconfig +++ /dev/null @@ -1,8 +0,0 @@ -DEAD_CODE_STRIPPING = YES -FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS) ../release/packagefolder/contents/macos ../release/packagefolder/contents/Frameworks -GCC_GENERATE_DEBUGGING_SYMBOLS = YES -GCC_OPTIMIZATION_LEVEL = 3 -LIBRARY_SEARCH_PATHS = $(LIBRARY_SEARCH_PATHS) ../release/packagefolder/contents/macos/libs -OTHER_REZFLAGS = -d __GNUC__ -d MACINTOSH -PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES -GCC_MODEL_TUNING = G5