Skip to content

Commit

Permalink
Merge pull request #454 from gdt050579/182-181-generic-plugins-droppe…
Browse files Browse the repository at this point in the history
…r-and-unpacker

182 181 generic plugins dropper and unpacker
  • Loading branch information
gheorghitamutu authored Jul 16, 2024
2 parents 8fbf90f + 71741b6 commit 4b94cec
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 16 deletions.
13 changes: 8 additions & 5 deletions AppCUI/include/AppCUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ namespace Utils
}
};
template <uint16 Size = 0xFFFF, typename T = char, typename T_view = std::string_view>
class GenericFixSizeString
class EXPORT GenericFixSizeString
{
static constexpr uint16 ACTUAL_SIZE = Size != 0xFFFF ? Size : 61 + (sizeof(T) - 1) * 2;
static_assert(ACTUAL_SIZE > 0);
Expand Down Expand Up @@ -4107,6 +4107,7 @@ namespace Controls
{
protected:
TabPage(const ConstString& caption);
TabPage(const ConstString& caption, int32 controlID);

public:
bool OnBeforeResize(int newWidth, int newHeight);
Expand Down Expand Up @@ -4696,7 +4697,7 @@ namespace Controls
Filter = 0x040000
};

class EXPORT Grid : public Control
class EXPORT Grid : public Control
{
protected:
Grid(string_view layout, uint32 columnsNo, uint32 rowsNo, GridFlags flags);
Expand Down Expand Up @@ -5015,9 +5016,11 @@ namespace Controls
TabPage() = delete;

public:
static Reference<Controls::TabPage> Create(Controls::Control* parent, const ConstString& caption);
static Reference<Controls::TabPage> Create(Controls::Control& parent, const ConstString& caption);
static Pointer<Controls::TabPage> Create(const ConstString& caption);
static Reference<Controls::TabPage> Create(
Controls::Control* parent, const ConstString& caption, int32 controlID = 0);
static Reference<Controls::TabPage> Create(
Controls::Control& parent, const ConstString& caption, int32 controlID = 0);
static Pointer<Controls::TabPage> Create(const ConstString& caption, int32 controlID = 0);
};
class EXPORT Tab
{
Expand Down
12 changes: 6 additions & 6 deletions AppCUI/src/Controls/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,18 @@ POINTER<Controls::TextArea> Factory::TextArea::Create(
}

//======[TABPAGE]====================================================================================
REFERENCE<TabPage> Factory::TabPage::Create(Controls::Control* parent, const ConstString& caption)
REFERENCE<TabPage> Factory::TabPage::Create(Controls::Control* parent, const ConstString& caption, int32 controlID)
{
VALIDATE_PARENT;
return parent->AddControl<Controls::TabPage>(Factory::TabPage::Create(caption));
return parent->AddControl<Controls::TabPage>(Factory::TabPage::Create(caption, controlID));
}
REFERENCE<TabPage> Factory::TabPage::Create(Controls::Control& parent, const ConstString& caption)
REFERENCE<TabPage> Factory::TabPage::Create(Controls::Control& parent, const ConstString& caption, int32 controlID)
{
return parent.AddControl<Controls::TabPage>(Factory::TabPage::Create(caption));
return parent.AddControl<Controls::TabPage>(Factory::TabPage::Create(caption, controlID));
}
POINTER<Controls::TabPage> Factory::TabPage::Create(const ConstString& caption)
POINTER<Controls::TabPage> Factory::TabPage::Create(const ConstString& caption, int32 controlID)
{
return POINTER<Controls::TabPage>(new Controls::TabPage(caption));
return POINTER<Controls::TabPage>(new Controls::TabPage(caption, controlID));
}

//======[TAB]========================================================================================
Expand Down
4 changes: 2 additions & 2 deletions AppCUI/src/Controls/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,8 @@ void GridControlContext::DrawLines(Renderer& renderer)
int minX = cWidth - 1;
int minY = cHeight - 1;

const int toAddColumn = std::max<>(0, deltaX / (int) cWidth);
const int toAddRow = std::max<>(0, deltaY / (int) cHeight);
const uint32 toAddColumn = std::max<>(0, deltaX / (int) cWidth);
const uint32 toAddRow = std::max<>(0, deltaY / (int) cHeight);

const auto color = Cfg->Lines.GetColor(GetControlState(ControlStateFlags::All));
for (auto i = toAddColumn; i < END(Layout.Width, offsetX, cWidth, columnsNo) + 1; i++)
Expand Down
7 changes: 6 additions & 1 deletion AppCUI/src/Controls/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void TabControlContext::PaintTopBottomPanelTab(Graphics::Renderer& renderer, boo

if ((this->Flags & TabFlags::TransparentBackground) != TabFlags::TransparentBackground)
renderer.FillRectSize(0, onTop ? 1 : 0, this->Layout.Width, this->Layout.Height - 1, ' ', this->GetPageColor());

if ((this->Flags & TabFlags::TabsBar) == TabFlags::TabsBar)
renderer.FillHorizontalLineSize(0, params.Y, this->Layout.Width, ' ', this->GetTabBarColor());

Expand Down Expand Up @@ -263,6 +263,11 @@ TabPage::TabPage(const ConstString& caption) : Control(new ControlContext(), cap
Members->Flags = GATTR_ENABLE | GATTR_VISIBLE | GATTR_TABSTOP;
}

TabPage::TabPage(const ConstString& caption, int32 controlID) : TabPage(caption)
{
this->SetControlID(controlID);
}

bool TabPage::OnBeforeResize(int, int)
{
return true;
Expand Down
2 changes: 1 addition & 1 deletion vcpkg
Submodule vcpkg updated 5003 files
63 changes: 63 additions & 0 deletions vcpkg-ports/ncurses/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
vcpkg_download_distfile(
ARCHIVE_PATH
URLS
"https://invisible-mirror.net/archives/ncurses/ncurses-${VERSION}.tar.gz"
"ftp://ftp.invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz"
"https://ftp.gnu.org/gnu/ncurses/ncurses-${VERSION}.tar.gz"
FILENAME "ncurses-${VERSION}.tgz"
SHA512 1c2efff87a82a57e57b0c60023c87bae93f6718114c8f9dc010d4c21119a2f7576d0225dab5f0a227c2cfc6fb6bdbd62728e407f35fce5bf351bb50cf9e0fd34
)

vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE_PATH}"
)

vcpkg_list(SET OPTIONS)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
list(APPEND OPTIONS
--with-cxx-shared
--with-shared # "lib model"
--without-normal # "lib model"
)
endif()


if(VCPKG_TARGET_IS_MINGW)
list(APPEND OPTIONS
--disable-home-terminfo
--enable-term-driver
--disable-termcap
)
endif()

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
DETERMINE_BUILD_TRIPLET
NO_ADDITIONAL_PATHS
OPTIONS
${OPTIONS}
--enable-widec
# --disable-db-install
--enable-pc-files
--without-ada
--without-debug # "lib model"
--without-manpages
# --without-progs
--without-tack
--without-tests
--with-pkg-config-libdir=libdir
--with-terminfo-dirs=/usr/share/terminfo:/usr/lib/terminfo:/etc/terminfo
)
vcpkg_install_make()

vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
7 changes: 7 additions & 0 deletions vcpkg-ports/ncurses/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The package ncurses is compatible with built-in CMake variables:

set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
target_include_directories(main PRIVATE ${CURSES_INCLUDE_DIRS})
target_compile_options(main PRIVATE ${CURSES_CFLAGS})
target_link_libraries(main PRIVATE ${CURSES_LIBRARIES})
9 changes: 9 additions & 0 deletions vcpkg-ports/ncurses/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ncurses",
"version": "6.4",
"port-version": 2,
"description": "Free software emulation of curses in System V Release 4.0, and more",
"homepage": "https://invisible-island.net/ncurses/announce.html",
"license": "MIT",
"supports": "!windows | mingw"
}
5 changes: 4 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
"name": "sdl2-ttf",
"platform": "windows | linux | osx"
}
]
],
"vcpkg-configuration": {
"overlay-ports": [ "./vcpkg-ports/ncurses"]
}
}

0 comments on commit 4b94cec

Please sign in to comment.