Skip to content

Commit 158d6ac

Browse files
committed
Ported to Windows too
1 parent 58c0450 commit 158d6ac

8,596 files changed

Lines changed: 21675 additions & 439 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Windows/BitPresent.cpp

Lines changed: 34 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#include <iostream>
2+
#include <SDL2/SDL_image.h>
23

34
#include "globals.h"
4-
#include "fileParser.h"
5-
#include "imageGenerator.h"
6-
#include "pdfCreator.h"
5+
#include "presentCreator.h"
6+
#include "gui.h"
77

88
//Initialize all global variables
9-
std::string Global::_VERSIONSTRING = "BitPresent v1.1.0";
9+
std::string Global::_VERSIONSTRING = "BitPresent v1.2.0";
1010

1111
int Global::_WIDTH = 1920;
1212
int Global::_HEIGHT = 1080;
1313
int Global::_BORDERS = 20;
1414
int Global::_INDENT = 40;
1515

16-
std::string Global::_OUTPATH = "";
17-
18-
Presentation* Global::_PRESENT = nullptr;
16+
std::vector<Presentation*> Global::_PRESENT;
17+
int Global::_CPRESENT = -1;
1918
int Global::_CSLIDE = -1;
2019
int Global::_CPOINT = -1;
2120

@@ -26,32 +25,39 @@ SDL_Color* Global::_DEFAULTTEXTCOLOR = nullptr;
2625
std::string Global::_BACKGROUND = "";
2726
std::string Global::_DEFAULTBACKGROUND = "";
2827

28+
bool Global::useGUI = false;
29+
guiApp* Global::gApp = nullptr;
30+
std::string Global::_INPATH = "";
31+
32+
std::string Global::_STATUS = "Ready";
33+
int Global::_MAXPROGRESS = 7;
34+
int Global::_PROGRESS = 0;
35+
2936
int main(int argc, char* argv[])
3037
{
3138
std::string inpath = "";
39+
std::string outpath = "";
3240

3341
//Check Argument length
3442
if (argc > 3)
3543
{
3644
printf("[ERROR]: Too many arguments\n");
45+
printf("[USAGE]: bitPresent <input_path> [<output_path>]\n");
3746
return -1;
3847
}
3948

40-
printf("%s\n", Global::_VERSIONSTRING.c_str());
41-
42-
if (argc < 2)
43-
{
44-
printf("[USAGE]: bitPresent <input_path> [<output_path>]\n\n");
45-
printf("Please enter the input file path: ");
46-
getline(std::cin, inpath);
47-
printf("Please enter the output file path: ");
48-
getline(std::cin, Global::_OUTPATH);
49-
}
49+
if (argc < 2) Global::useGUI = true;
5050
else
5151
{
5252
inpath = argv[1];
53-
if (argc == 3) Global::_OUTPATH = argv[2];
54-
else Global::_OUTPATH = "presentation.pdf";
53+
int lastDirSep = inpath.find_last_of("/\\");
54+
std::string tmp = inpath.substr(0, lastDirSep + 1);
55+
inpath = tmp;
56+
57+
Global::_INPATH = inpath;
58+
59+
if (argc == 3) outpath = argv[2];
60+
else outpath = "presentation.pdf";
5561
}
5662

5763
//Initialize SDL for future Ops
@@ -76,35 +82,16 @@ int main(int argc, char* argv[])
7682
Global::_DEFAULTBACKGROUND = "none";
7783
Global::_BACKGROUND = Global::_DEFAULTBACKGROUND;
7884

79-
//Split input file into tokens
80-
std::vector<std::string> tokens = tokenize(inpath);
81-
if (tokens.size() == 0)
82-
{
83-
printf("[ERROR]: Error while opening file\n");
84-
return -1;
85-
}
86-
87-
//Create global Presentation object
88-
Global::_PRESENT = new Presentation();
89-
90-
//Parse tokens to global Presentation object
91-
parse(tokens);
92-
93-
//Generate images for each Slide
94-
for (int i = 0; i < Global::_PRESENT->slides.size(); i++)
85+
//Create Presentation
86+
if (Global::useGUI)
9587
{
96-
SDL_Surface* surface = generateSurface(i);
97-
if (surface == nullptr) return -1;
98-
99-
saveImage(surface, "cache/" + std::to_string(i) + ".png");
100-
SDL_FreeSurface(surface);
88+
//Init and enter GUI
89+
Global::gApp = new guiApp();
90+
wxApp::SetInstance(Global::gApp);
91+
wxEntry(argc, argv);
92+
wxEntryCleanup();
10193
}
102-
103-
printf("[OK]: Created all Images\n");
104-
105-
//Create PDF
106-
createPDF();
107-
printf("[OK]: Created PDF file\n");
94+
else if (createPresent(inpath, outpath) == -1) return -1;
10895

10996
//Clear Fonts
11097
TTF_CloseFont(Global::_FONT["title"]);
@@ -116,7 +103,5 @@ int main(int argc, char* argv[])
116103
TTF_Quit();
117104
SDL_Quit();
118105

119-
printf("[FINISHED]: Done creating presentation\n");
120-
121106
return 0;
122-
}
107+
}

Windows/BitPresent.vcxproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@
2020
</ItemGroup>
2121
<ItemGroup>
2222
<ClCompile Include="BitPresent.cpp" />
23+
<ClCompile Include="fileParser.cpp" />
24+
<ClCompile Include="gui.cpp" />
25+
<ClCompile Include="imageGenerator.cpp" />
26+
<ClCompile Include="pdfCreator.cpp" />
27+
<ClCompile Include="presentCreator.cpp" />
2328
</ItemGroup>
2429
<ItemGroup>
2530
<ClInclude Include="fileParser.h" />
2631
<ClInclude Include="globals.h" />
32+
<ClInclude Include="gui.h" />
2733
<ClInclude Include="imageGenerator.h" />
2834
<ClInclude Include="objects.h" />
2935
<ClInclude Include="pdfCreator.h" />
36+
<ClInclude Include="presentCreator.h" />
3037
<ClInclude Include="resource.h" />
3138
</ItemGroup>
3239
<ItemGroup>
@@ -136,15 +143,16 @@
136143
<FunctionLevelLinking>true</FunctionLevelLinking>
137144
<IntrinsicFunctions>true</IntrinsicFunctions>
138145
<SDLCheck>true</SDLCheck>
139-
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
146+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_DEPRECATE; _CRT_NONSTDC_NO_DEPRECATE;WINVER=0x0400;__WXMSW__;_WINDOWS;wxUSE_GUI=1;WXUSINGDLL</PreprocessorDefinitions>
140147
<ConformanceMode>true</ConformanceMode>
148+
<LanguageStandard>stdcpp17</LanguageStandard>
141149
</ClCompile>
142150
<Link>
143-
<SubSystem>Console</SubSystem>
151+
<SubSystem>Windows</SubSystem>
144152
<EnableCOMDATFolding>true</EnableCOMDATFolding>
145153
<OptimizeReferences>true</OptimizeReferences>
146154
<GenerateDebugInformation>true</GenerateDebugInformation>
147-
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);manual-link\SDL2main.lib;SDL2.lib;SDL2_ttf.lib;SDL2_image.lib;turbojpeg.lib;webp.lib</AdditionalDependencies>
155+
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);manual-link\SDL2main.lib;SDL2.lib;SDL2_ttf.lib;SDL2_image.lib;turbojpeg.lib;webp.lib;wxbase31u.lib;wxbase31u_net.lib;wxbase31u_xml.lib;wxmsw31u_adv.lib;wxmsw31u_aui.lib;wxmsw31u_core.lib;wxmsw31u_gl.lib;wxmsw31u_html.lib;wxmsw31u_media.lib;wxmsw31u_propgrid.lib;wxmsw31u_qa.lib;wxmsw31u_ribbon.lib;wxmsw31u_richtext.lib;wxmsw31u_stc.lib;wxmsw31u_webview.lib;wxmsw31u_xrc.lib;comctl32.lib;rpcrt4.lib;winmm.lib;wsock32.lib</AdditionalDependencies>
148156
</Link>
149157
</ItemDefinitionGroup>
150158
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

Windows/BitPresent.vcxproj.filters

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,32 @@
3333
<ClInclude Include="resource.h">
3434
<Filter>Headerdateien</Filter>
3535
</ClInclude>
36+
<ClInclude Include="gui.h">
37+
<Filter>Headerdateien</Filter>
38+
</ClInclude>
39+
<ClInclude Include="presentCreator.h">
40+
<Filter>Headerdateien</Filter>
41+
</ClInclude>
3642
</ItemGroup>
3743
<ItemGroup>
3844
<ClCompile Include="BitPresent.cpp">
3945
<Filter>Quelldateien</Filter>
4046
</ClCompile>
47+
<ClCompile Include="fileParser.cpp">
48+
<Filter>Quelldateien</Filter>
49+
</ClCompile>
50+
<ClCompile Include="gui.cpp">
51+
<Filter>Quelldateien</Filter>
52+
</ClCompile>
53+
<ClCompile Include="imageGenerator.cpp">
54+
<Filter>Quelldateien</Filter>
55+
</ClCompile>
56+
<ClCompile Include="pdfCreator.cpp">
57+
<Filter>Quelldateien</Filter>
58+
</ClCompile>
59+
<ClCompile Include="presentCreator.cpp">
60+
<Filter>Quelldateien</Filter>
61+
</ClCompile>
4162
</ItemGroup>
4263
<ItemGroup>
4364
<ResourceCompile Include="BitPresent.rc">

Windows/Release/BitPresent.exe

88 KB
Binary file not shown.

Windows/Release/BitPresent.iobj

858 KB
Binary file not shown.

Windows/Release/BitPresent.ipdb

495 KB
Binary file not shown.

Windows/Release/BitPresent.log

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
 BitPresent.cpp
2-
D:\Coding\BitPresentWindows\BitPresent\fileParser.h(50,20): warning C4018: '<': signed/unsigned mismatch
3-
D:\Coding\BitPresentWindows\BitPresent\imageGenerator.h(125,27): warning C4018: '<': signed/unsigned mismatch
4-
D:\Coding\BitPresentWindows\BitPresent\imageGenerator.h(149,30): warning C4018: '<': signed/unsigned mismatch
5-
D:\Coding\BitPresentWindows\BitPresent\pdfCreator.h(24,23): warning C4018: '<': signed/unsigned mismatch
6-
D:\Coding\BitPresentWindows\BitPresent\pdfCreator.h(27,46): warning C4244: 'argument': conversion from 'int' to 'HPDF_REAL', possible loss of data
7-
D:\Coding\BitPresentWindows\BitPresent\pdfCreator.h(28,47): warning C4244: 'argument': conversion from 'int' to 'HPDF_REAL', possible loss of data
8-
D:\Coding\BitPresentWindows\BitPresent\pdfCreator.h(31,100): warning C4244: 'argument': conversion from 'HPDF_UINT' to 'HPDF_REAL', possible loss of data
9-
D:\Coding\BitPresentWindows\BitPresent\pdfCreator.h(31,71): warning C4244: 'argument': conversion from 'HPDF_UINT' to 'HPDF_REAL', possible loss of data
10-
D:\Coding\BitPresentWindows\BitPresent\BitPresent.cpp(94,20): warning C4018: '<': signed/unsigned mismatch
11-
Generating code
12-
1 of 566 functions ( 0.2%) were compiled, the rest were copied from previous compilation.
13-
0 functions were new in current compilation
14-
1 functions had inline decision re-evaluated but remain unchanged
15-
Finished generating code
16-
BitPresent.vcxproj -> D:\Coding\BitPresentWindows\BitPresent\Release\BitPresent.exe
1+
 BitPresent.vcxproj -> D:\Coding\BitPresentWindows\BitPresent\Release\BitPresent.exe

Windows/Release/BitPresent.obj

4.36 MB
Binary file not shown.

Windows/Release/BitPresent.pdb

2.27 MB
Binary file not shown.
-16.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)