Skip to content

Commit

Permalink
AC26 compatibility (Xcode)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-wessel committed Nov 13, 2024
1 parent 30b1d4d commit d78a443
Show file tree
Hide file tree
Showing 43 changed files with 2,387 additions and 79 deletions.
1,313 changes: 1,313 additions & 0 deletions SpeckleConnector/Connector.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21BD79802CE23E4D00526AD1"
BuildableName = "Connector-AC25-EN-GB.bundle"
BuildableName = "Speckle Connector.bundle"
BlueprintName = "Connector-AC25-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -55,7 +55,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21BD79802CE23E4D00526AD1"
BuildableName = "Connector-AC25-EN-GB.bundle"
BuildableName = "Speckle Connector.bundle"
BlueprintName = "Connector-AC25-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21BD79802CE23E4D00526AD1"
BuildableName = "Connector-AC25-EN-GB.bundle"
BuildableName = "Speckle Connector.bundle"
BlueprintName = "Connector-AC25-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -55,7 +55,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21BD79802CE23E4D00526AD1"
BuildableName = "Connector-AC25-EN-GB.bundle"
BuildableName = "Speckle Connector.bundle"
BlueprintName = "Connector-AC25-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21CE8A922CE4F3370076522F"
BuildableName = "Connector-AC26-EN-GB.bundle"
BlueprintName = "Connector-AC26-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
FilePath = "/Applications/Graphisoft/Archicad 26/Archicad 26.app">
</PathRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "21CE8A922CE4F3370076522F"
BuildableName = "Connector-AC26-EN-GB.bundle"
BlueprintName = "Connector-AC26-EN-GB"
ReferencedContainer = "container:Connector.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
FilePath = "/Applications/Graphisoft/Archicad 27/Archicad 27.app">
</PathRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
20 changes: 19 additions & 1 deletion SpeckleConnector/Connector/Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "Speckle/Environment/Addon.h"
#include "Speckle/Utility/String.h"

#include <mutex>

using namespace active::file;
using namespace active::environment;
using namespace connector;
Expand All @@ -23,10 +25,21 @@ namespace {
//The account database name
const char* accountDBaseName = "Accounts.db";

///The Connector addon class

/*!
Class for a concrete instance of an add-on
This class is private to prevent ad-hoc construction of instances while fulfilling the requirements of the public interface. Essentially
this should behave as a singleton, representing the sole instance of the running add-on
*/
class ConnectorInstance : public ConnectorAddon {
public:
/*!
Constructor
@param name The connector add-on name
*/
ConnectorInstance(const String& name) : ConnectorAddon{name} {
//Define the connector UI components
add<ConnectorMenu>();
add<ConnectorPalette>();
}
Expand All @@ -49,9 +62,13 @@ namespace {
}

private:
///The accounts database - always a single instance for the active user
mutable std::unique_ptr<AccountDatabase> m_account;
///Mutex to control access to the accounts database
mutable std::mutex m_accountMutex;
};


///The active addon instance
std::unique_ptr<ConnectorAddon> m_addonInstance;

Expand Down Expand Up @@ -85,6 +102,7 @@ ConnectorAddon::ConnectorAddon(const speckle::utility::String& name) : Addon{nam
return: The account database
--------------------------------------------------------------------*/
const AccountDatabase* ConnectorInstance::getAccountDatabase() const {
const std::lock_guard<std::mutex> lock{m_accountMutex};
if (!m_account) {
auto speckleDirectory = getAppDataDirectory();
if (!speckleDirectory)
Expand Down
1 change: 0 additions & 1 deletion SpeckleConnector/Connector/Connector.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "Speckle/Environment/Addon.h"
#include "Speckle/Utility/String.h"

namespace speckle::database {
class AccountDatabase;
Expand Down
8 changes: 4 additions & 4 deletions SpeckleConnector/Connector/Event/ConnectorEventID.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

//Identifier for event signalling the connector palette visibility should be toggled
inline const active::utility::NameID toggleConnectorPaletteID{"toggleConnectorPalette"};
//Identifier for event signalling the connector palette menu checked state should be set (state carried with event)
inline const active::utility::NameID setConnectorMenuCheckID{"setConnectorMenuCheck"};
//Identifier for event signalling the connector palette has changed (state carried with event)
inline const active::utility::NameID reflectPaletteVisibilityID{"setConnectorMenuCheck"};

// MARK: - Event setting identities

//Identifier for event signalling the connector palette menu checked state should be set (state carried with event)
inline const active::utility::NameID menuCheckStateID{"menuCheckState"};
//Identifier for event signalling the connector palette visibility state
inline const active::utility::NameID paletteVisibilityStateID{"menuCheckState"};

#endif //CONNECTOR_EVENT_ID
8 changes: 4 additions & 4 deletions SpeckleConnector/Connector/Interface/ConnectorMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ConnectorMenu::ConnectorMenu()
--------------------------------------------------------------------*/
Subscriber::Subscription ConnectorMenu::subscription() const {
auto result = MenuSubscriber::subscription();
result.insert(setConnectorMenuCheckID);
result.insert(reflectPaletteVisibilityID);
return result;
} //ConnectorMenu::subscription

Expand All @@ -48,10 +48,10 @@ Subscriber::Subscription ConnectorMenu::subscription() const {
return: True if the event should be closed
--------------------------------------------------------------------*/
bool ConnectorMenu::receive(const active::event::Event& event) {
if (event != setConnectorMenuCheckID)
if (event != reflectPaletteVisibilityID)
return MenuSubscriber::receive(event);
//Get the menu checked state from the event and apply it to the menu
if (auto menuState = event.findValue(menuCheckStateID); menuState != nullptr)
//Set the menu checked state based on the palette visibility from the event
if (auto menuState = event.findValue(paletteVisibilityStateID); menuState != nullptr)
setMenuChecked(connectorMenuItem, menuState->boolVal());
return false;
} //ConnectorMenu::receive
Expand Down
14 changes: 7 additions & 7 deletions SpeckleConnector/Connector/Interface/ConnectorPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace {
std::shared_ptr<DG::Browser> browser;

void InitBrowserControl();
void SetMenuItemCheckedState(bool);
void publshVisibilityChange(bool);

virtual void PanelResized(const DG::PanelResizeEvent& ev) override;
virtual void PanelCloseRequested(const DG::PanelCloseRequestEvent& ev, bool* accepted) override;
Expand Down Expand Up @@ -198,7 +198,7 @@ static GSErrCode __ACENV_CALL NotificationHandler(API_NotifyEventID notifID, Int
BrowserPalette::BrowserPalette() :
DG::Palette(ACAPI_GetOwnResModule(), BrowserPaletteResId, ACAPI_GetOwnResModule(), paletteGuid) {
browser = std::make_shared<DG::Browser>(GetReference(), BrowserId);
#ifdef ServerMainVers_2600
#ifdef ServerMainVers_2700
ACAPI_ProjectOperation_CatchProjectEvent(APINotify_Quit, NotificationHandler);
#else
ACAPI_Notify_CatchProjectEvent(APINotify_Quit, NotificationHandler);
Expand Down Expand Up @@ -254,12 +254,12 @@ void BrowserPalette::DestroyInstance() {

void BrowserPalette::Show() {
DG::Palette::Show();
SetMenuItemCheckedState(true);
publshVisibilityChange(true);
}

void BrowserPalette::Hide() {
DG::Palette::Hide();
SetMenuItemCheckedState(false);
publshVisibilityChange(false);
}

void BrowserPalette::InitBrowserControl() {
Expand All @@ -272,9 +272,9 @@ void BrowserPalette::InitBrowserControl() {
}


void BrowserPalette::SetMenuItemCheckedState(bool isChecked) {
//Request a change to the menu checked state
app()->publish(Event{setConnectorMenuCheckID, { ValueSetting{isChecked, menuCheckStateID} }});
void BrowserPalette::publshVisibilityChange(bool isChecked) {
//Signal that the palette visibility has changed
app()->publish(Event{reflectPaletteVisibilityID, { ValueSetting{isChecked, paletteVisibilityStateID} }});
}

void BrowserPalette::PanelResized(const DG::PanelResizeEvent& ev) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "ActiveLibDoctest/TestingPlatforms.h"

#include "Connector/Record/Model/CardMover.h"
#include "Connector/Record/Model/ModelCard.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/JSON/JSONTransport.h"
#include "Active/Utility/BufferIn.h"
#include "Speckle/Utility/String.h"

namespace {

speckle::utility::String json{"{\n\
\"typeDiscriminator\": \"SenderModelCard\",\n\
\"modelCardId\": \"8a007ac08b43771ec20d\",\n\
\"modelId\": \"c9b5a4fa94\",\n\
\"projectId\": \"ce9a0d130e\",\n\
\"workspaceId\": \"10ee1c0f73\",\n\
\"accountId\": \"5724C96F3FF796628292B6E67E86CC2F\",\n\
\"serverUrl\": \"https://app.speckle.systems\",\n\
\"expired\": false,\n\
\"sendFilter\": {\n\
\"typeDiscriminator\": \"ArchicadSelectionFilter\",\n\
\"selectedObjectIds\": [\n\
\"7B531D03-0219-420F-BE86-633451AEF19B\"\n\
],\n\
\"name\": \"Selection\",\n\
\"summary\": \"1 objects selected.\"\n\
}\n\
}"};

}
using namespace speckle::utility;

TEST_SUITE(TESTQ(ModelCardSerialiseTest)) TEST_SUITE_OPEN

///Test for deserialising a ModelCard
TEST_CASE(TESTQ(deserialiseModelCard)) {
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
CardHold result;
active::serialise::json::JSONTransport().receive(std::forward<CardHold&&>(result), active::serialise::Identity{}, json);
}

TEST_SUITE_CLOSE
30 changes: 30 additions & 0 deletions SpeckleConnector/RINT.Archicad/EN-GB/Module-Info26.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>Speckle Connector for Archicad 26</string>
<key>CFBundleIconFile</key>
<string>ArchiCADPlugin.icns</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Speckle Connector</string>
<key>CFBundlePackageType</key>
<string>.APX</string>
<key>CFBundleShortVersionString</key>
<string>Speckle Connector</string>
<key>CFBundleSignature</key>
<string>GSAP</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSRequiresCarbon</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit d78a443

Please sign in to comment.