Skip to content

Commit

Permalink
Merge pull request #274 from coderofsalvation/feat/helpdialog-ctrl-h
Browse files Browse the repository at this point in the history
feature: ctrl h triggers helpscreen
  • Loading branch information
coderofsalvation committed Aug 26, 2022
2 parents 6d5dafa + bc25397 commit caa8169
Show file tree
Hide file tree
Showing 8 changed files with 4,639 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/MilkyTracker.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@
<body>
<h1>MilkyTracker Manual <span id="version" style="font-size: small; font-weight: normal;">v1.03</span></h1>
<p>
Hello and welcome to MilkyTracker, an open source multi-platform Fasttracker II compatible music tracker program. This document holds a lot of valuable information about the tracker but it's not a tracking manual. If you want to learn more about tracking and how it's done, the Internet is your friend. We host some resources on <a href="http://milkytracker.titandemo.org/">MilkyTracker.titandemo.org</a> as well.
Hello and welcome to MilkyTracker, an all-in-one Tracker musicstudio.<br>
It's opensource, multi-platform and inspired (and compatible) with Fasttracker.
</p>
<h4>Disclaimer:</h4>
<p>
Expand Down Expand Up @@ -3176,6 +3177,9 @@ <h4>
<tr>
<td><em>Deltafire</em></td><td>maintainer since v0.90.85</td>
</tr>
<tr>
<td><em>coderofsalvation</em></td><td>maintainer since v1.03.00</td>
</tr>
<tr>
<td><em>kenet</em></td><td>graphics</td>
</tr>
Expand Down
8 changes: 8 additions & 0 deletions src/tools/generateHelp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -x
printf "\n\n" > milkytracker.help
lynx -dump ./docs/MilkyTracker.html | grep -v "file:" | awk '{ print " "$0"\n" }' >> milkytracker.help
{
echo "// generated by src/tools/generateHelp.sh"
xxd -i milkytracker.help
} > src/tracker/DialogHelpText.h
1 change: 1 addition & 0 deletions src/tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_executable(tracker
AnimatedFXControl.cpp
ColorExportImport.cpp
ColorPaletteContainer.cpp
DialogHelp.cpp
DialogChannelSelector.cpp
DialogEQ.cpp
DialogGroupSelection.cpp
Expand Down
79 changes: 79 additions & 0 deletions src/tracker/DialogHelp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* tracker/DialogHelp.cpp
*
* Copyright 2022 coderofsalvation / Leon van Kammen
*
* This file is part of Milkytracker.
*
* Milkytracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Milkytracker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Milkytracker. If not, see <http://www.gnu.org/licenses/>.
*
*/

/*
* DialogHelp.cpp
* MilkyTracker
*
* Created by coderofsalvation / Leon van Kammen on 13-07-2022
*
*/

#include "DialogHelp.h"
#include "DialogHelpText.h"
#include "MessageBoxContainer.h"
#include "ListBox.h"
#include "PPUI.h"

DialogHelp::DialogHelp(PPScreen *screen,
DialogResponder *responder,
pp_int32 id,
const PPString &caption,
bool okCancel /* = false*/) : PPDialogBase()
{
char line[HELP_MAX_LINE];
pp_int32 w = 800;
pp_int32 h = screen->getHeight() - 200;
if (okCancel)
initDialog(screen, responder, id, caption, w, h, 26, "Ok", "Cancel");
else
initDialog(screen, responder, id, caption, w, h, 26, "Okay");

pp_int32 x = getMessageBoxContainer()->getLocation().x;
pp_int32 y = getMessageBoxContainer()->getLocation().y;

pp_int32 width = getMessageBoxContainer()->getSize().width;
pp_int32 height = getMessageBoxContainer()->getSize().height;

PPButton *button = static_cast<PPButton *>(messageBoxContainerGeneric->getControlByID(PP_MESSAGEBOX_BUTTON_YES));
pp_int32 y2 = button->getLocation().y;
pp_int32 x2 = x + width / 2 - 30;

y2 = getMessageBoxContainer()->getControlByID(MESSAGEBOX_STATICTEXT_MAIN_CAPTION)->getLocation().y + 18;
x2 = x + width / 2 - 120;

listBox = new PPListBox(MESSAGEBOX_LISTBOX_USER1, screen, this, PPPoint(x + 12, y + (3 * 8)), PPSize(width - (3 * 8), height - (8 * 8)), true, false, true, true);
listBox->setShowIndex(true);
memset(line, 0, HELP_MAX_LINE);
for (pp_int32 i = 0; i < milkytracker_help_len; i++)
{
char c = milkytracker_help[i];
if (c == '\n')
{
listBox->addItem(line);
memset(line, 0, HELP_MAX_LINE);
}
else
sprintf(line, "%s%c", line, c);
}
messageBoxContainerGeneric->addControl(listBox);
}
54 changes: 54 additions & 0 deletions src/tracker/DialogHelp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* tracker/DialogHelp.h
*
* Copyright 2022 coderofsalvation / Leon van Kammen
*
* This file is part of Milkytracker.
*
* Milkytracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Milkytracker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Milkytracker. If not, see <http://www.gnu.org/licenses/>.
*
*/

/*
* DialogHelp.h
* MilkyTracker
*
* Created by coderofsalvation / Leon van Kammen on 13-07-2022
*
*/

#ifndef __DIALOGHELP_H__
#define __DIALOGHELP_H__

#include "DialogBase.h"

#define HELP_MAX_LINE 255

class DialogHelp : public PPDialogBase
{
private:
class PPListBox* listBox;

public:
DialogHelp(PPScreen* screen,
DialogResponder* responder,
pp_int32 id,
const PPString& caption,
bool okCancel = false);

PPListBox* getListBox() { return listBox; }

};

#endif
Loading

0 comments on commit caa8169

Please sign in to comment.