Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tdolphin-org committed Nov 5, 2024
1 parent cf4bf21 commit 7807e17
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ It is complex example of usage [MUI C++ wrapper classes](https://github.com/tdol
- [MUI5](https://github.com/amiga-mui/muidev)
- [Identify.library](https://github.com/shred/identify) (download [IdentifyUsr.lha](http://aminet.net/util/libs/IdentifyUsr.lha))
- optional [OpenURL.library](https://github.com/jens-maus/libopenurl) (download [OpenURL.lha](http://aminet.net/comm/www/OpenURL-7.18.lha))
- optional [Picasso96](http://wiki.icomp.de/wiki/P96)

## WIP interface

Expand Down
2 changes: 1 addition & 1 deletion app/appversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export APP_VERSION = 0.1.4
export APP_VERSION = 0.1.5
9 changes: 6 additions & 3 deletions app/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "App.hpp"

#include "Components/Application.hpp"
#include "MUI/Context/ApplicationContext.hpp"
#include "MUI/Core/CustomClassManager.hpp"

Expand All @@ -25,11 +26,13 @@ void AppCore::Run()
// special class, on destructor Dispose all custom classes
MUI::CustomClassesLifeTimeScope customClassesLifeTimeScope;

Components::Application muiApplication;

// application scope
// do MUI_DisposeObject(..) on destructor
MUI::ApplicationScope application(mApplication);
MUI::ApplicationScope application(muiApplication);

mApplication.RegisterEvents();
muiApplication.RegisterEvents();

auto appWindow = MUI::ApplicationContext::instance().getAppWindow();

Expand All @@ -38,7 +41,7 @@ void AppCore::Run()

// main application loop
ULONG signals = 0;
while (DoMethod(mApplication.muiObject(), MUIM_Application_NewInput, &signals) != MUIV_Application_ReturnID_Quit)
while (DoMethod(muiApplication.muiObject(), MUIM_Application_NewInput, &signals) != MUIV_Application_ReturnID_Quit)
{
if (signals)
{
Expand Down
3 changes: 0 additions & 3 deletions app/src/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "AOS/Identify/IdentifyBaseScope.hpp"
#include "AOS/OpenURL/OpenURLBaseScope.hpp"
#include "AOS/Picasso96/Picasso96BaseScope.hpp"
#include "Components/Application.hpp"
#include "Core/Singleton.hpp"
#include "MUI/Core/MuiMasterBaseScope.hpp"

Expand All @@ -26,8 +25,6 @@ class AppCore
OpenURLBaseScope openUrlBaseScope;
Picasso96BaseScope picasso96BaseScope;

Components::Application mApplication;

AppCore();

public:
Expand Down
5 changes: 5 additions & 0 deletions app/src/AppContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ OpenURLBaseScope &AppContextCore::getOpenURLBase() const
{
return App::instance().openUrlBaseScope;
}

Picasso96BaseScope &AppContextCore::getPicasso96Base() const
{
return App::instance().picasso96BaseScope;
}
2 changes: 2 additions & 0 deletions app/src/AppContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include "AOS/OpenURL/OpenURLBaseScope.hpp"
#include "AOS/Picasso96/Picasso96BaseScope.hpp"
#include "Core/Singleton.hpp"

class AppContextCore
Expand All @@ -18,6 +19,7 @@ class AppContextCore

public:
OpenURLBaseScope &getOpenURLBase() const;
Picasso96BaseScope &getPicasso96Base() const;
};

/// @brief main AppContext (singleton) object
Expand Down
11 changes: 9 additions & 2 deletions app/src/Components/Tabs/GraphicsTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "AOS/Identify/Library.hpp"
#include "AOS/Picasso96/Library.hpp"
#include "AppContext.hpp"
#include "MUI/Core/MakeObject.hpp"

namespace Components
Expand Down Expand Up @@ -54,14 +55,20 @@ namespace Components
}
}

if (!AppContext::instance().getPicasso96Base().isOpen())
{
mPicasso96Boards.AddTail(LabelText("none"));
return;
}

auto picassoBoards = AOS::Picasso96::Library::GetBoards();
if (picassoBoards.empty())
mPicasso96Boards.AddTail(LabelText("none"));
else
{
mPicasso96Boards.AddTail(MUI::TextBuilder().tagContents("Name").object());
mPicasso96Boards.AddTail(MUI::TextBuilder().tagContents("Video RAM").object());
mPicasso96Boards.AddTail(MUI::TextBuilder().tagContents("Video RAM Clock").object());
mPicasso96Boards.AddTail(MUI::TextBuilder().tagContents("Video Memory Size").object());
mPicasso96Boards.AddTail(MUI::TextBuilder().tagContents("Video Memory Clock").object());

for (auto &picassoBoard : picassoBoards)
{
Expand Down
1 change: 1 addition & 0 deletions app/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "App.hpp"

#include <dos/dos.h>
#include <iostream>

using namespace std;
Expand Down

0 comments on commit 7807e17

Please sign in to comment.