Skip to content

Commit

Permalink
Add about dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Sep 13, 2024
1 parent 616fcdd commit fd28356
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 8 deletions.
25 changes: 25 additions & 0 deletions archicad-addon/Sources/AboutDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "AboutDialog.hpp"

#include "AddOnVersion.hpp"
#include "ResourceIds.hpp"

#include "ACAPinc.h"

AboutDialog::AboutDialog () :
DG::ModalDialog (ACAPI_GetOwnResModule (), ID_ABOUT_DIALOG, ACAPI_GetOwnResModule ()),
okButton (GetReference (), 1),
versionText (GetReference (), 4)
{
AttachToAllItems (*this);
Attach (*this);

GS::UniString versionTextContent = versionText.GetText ();
versionText.SetText (GS::UniString::SPrintf (versionTextContent, GS::UniString (ADDON_VERSION).ToPrintf ()));
}

void AboutDialog::ButtonClicked (const DG::ButtonClickEvent& ev)
{
if (ev.GetSource () == &okButton) {
PostCloseRequest (DG::ModalDialog::Accept);
}
}
19 changes: 19 additions & 0 deletions archicad-addon/Sources/AboutDialog.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include "DGModule.hpp"

class AboutDialog :
public DG::ModalDialog,
public DG::PanelObserver,
public DG::ButtonItemObserver,
public DG::CompoundItemObserver
{
public:
AboutDialog ();

private:
virtual void ButtonClicked (const DG::ButtonClickEvent& ev) override;

DG::Button okButton;
DG::CenterText versionText;
};
9 changes: 7 additions & 2 deletions archicad-addon/Sources/AddOnMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "ResourceIds.hpp"
#include "DeveloperTools.hpp"

#include "AboutDialog.hpp"

#include "ApplicationCommands.hpp"
#include "ProjectCommands.hpp"
#include "ElementCommands.hpp"
Expand Down Expand Up @@ -50,8 +52,11 @@ static GSErrCode MenuCommandHandler (const API_MenuParams* menuParams)
switch (menuParams->menuItemRef.menuResID) {
case ID_ADDON_MENU:
switch (menuParams->menuItemRef.itemIndex) {
case ID_ADDON_MENU_GENERATE_DOC:
//GenerateDocumentation ();
case ID_ADDON_MENU_ABOUT:
{
AboutDialog aboutDialog;
aboutDialog.Invoke ();
}
break;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion archicad-addon/Sources/DeveloperTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class GenerateDocumentationCommand : public CommandBase
virtual GS::ObjectState Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const override;
};

void AddCommandGroup (const CommandGroup& commandGroup);
void AddCommandGroup (const CommandGroup& commandGroup);
6 changes: 5 additions & 1 deletion archicad-addon/Sources/RFIX/AddOnFix.grc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "ResourceIds.hpp"

'MDID' ID_ADDON_ID "Add-On Identifier" {
'MDID' 32500 "Add-On Identifier" {
826567491
368333322
}

'GICN' ID_TAPIR_LOGO "TapirLogo" {
"TapirLogo"
}
76 changes: 76 additions & 0 deletions archicad-addon/Sources/RFIX/Images/TapirLogo_128x128.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions archicad-addon/Sources/RINT/AddOn.grc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@

'STR#' ID_ADDON_MENU "Add-On Menu" {
/* [ ] */ "Tapir"
/* [ ] */ "Developer Tools"
/* [ 1] */ "Generate Documentation"
/* [ 1] */ "About Tapir..."
}

'GDLG' ID_ABOUT_DIALOG Modal 40 40 200 237 "Tapir" {
/* [ 1] */ Button 10 204 180 23 LargePlain "OK"
/* [ 2] */ Icon 36 10 128 128 ID_TAPIR_LOGO
/* [ 3] */ CenterText 10 148 180 23 LargeBold vCenter "Tapir Archicad Automation"
/* [ 4] */ CenterText 10 171 180 23 LargePlain vCenter "Version %T"
}

'DLGH' ID_ABOUT_DIALOG Save_USDZ_Options {
1 "" OkButton
2 "" TapirLogo
3 "" TapirText
4 "" VersionText
}
6 changes: 4 additions & 2 deletions archicad-addon/Sources/ResourceIds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#define ID_ADDON_INFO_DESC 2

#define ID_ADDON_MENU 32001
#define ID_ADDON_MENU_GENERATE_DOC 1
#define ID_ADDON_MENU_ABOUT 1

#define ID_ADDON_ID 32500
#define ID_TAPIR_LOGO 32502

#define ID_ABOUT_DIALOG 32003

0 comments on commit fd28356

Please sign in to comment.