-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HackStudio: Project templates and New Project dialog
This commit adds a simple project template system to HackStudio, as well as a pretty New Project dialog, inspired by early VS.NET and MS Office.
- Loading branch information
1 parent
a6fdc17
commit b671577
Showing
24 changed files
with
1,178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[HackStudioTemplate] | ||
Name=Command-line Application (C++) | ||
Description=Template for creating a basic C++ command-line application. | ||
Priority=95 | ||
IconName32x=cpp-basic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
echo "PROGRAM = $1" >> $2/Makefile | ||
echo "OBJS = main.o" >> $2/Makefile | ||
echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "all: \$(PROGRAM)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile | ||
echo " \$(CXX) -o \$@ \$(OBJS)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "%.o: %.cpp" >> $2/Makefile | ||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "clean:" >> $2/Makefile | ||
echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "run:" >> $2/Makefile | ||
echo " ./\$(PROGRAM)" >> $2/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
printf("Hello friends!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[HackStudioTemplate] | ||
Name=Graphical Application (C++) | ||
Description=Template for creating a basic C++ graphical application. | ||
Priority=90 | ||
IconName32x=cpp-gui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
echo "PROGRAM = $1" >> $2/Makefile | ||
echo "OBJS = main.o" >> $2/Makefile | ||
echo "CXXFLAGS = -lgui -g -std=c++2a" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "all: \$(PROGRAM)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile | ||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ \$(OBJS)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "%.o: %.cpp" >> $2/Makefile | ||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "clean:" >> $2/Makefile | ||
echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "run:" >> $2/Makefile | ||
echo " ./\$(PROGRAM)" >> $2/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdio.h> | ||
#include <LibGUI/Application.h> | ||
#include <LibGUI/Window.h> | ||
#include <LibGUI/Button.h> | ||
#include <LibGUI/MessageBox.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
auto app = GUI::Application::construct(argc, argv); | ||
|
||
auto window = GUI::Window::construct(); | ||
window->set_title("Hello friends!"); | ||
window->resize(200, 100); | ||
|
||
auto button = GUI::Button::construct(); | ||
button->set_text("Click me!"); | ||
button->on_click = [&](auto) { | ||
GUI::MessageBox::show(window, "Hello friends!", ":^)"); | ||
}; | ||
|
||
window->set_main_widget(button); | ||
|
||
window->show(); | ||
|
||
return app->exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[HackStudioTemplate] | ||
Name=Shared Library (C++) | ||
Description=Template for creating a C++ shared library. | ||
IconName32x=cpp-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
# $1: Project name, filesystem safe | ||
# $2: Project full path | ||
# $3: Project name, namespace safe | ||
|
||
# Generate Makefile | ||
echo "LIBRARY = $1.so" >> $2/Makefile | ||
echo "OBJS = Class1.o" >> $2/Makefile | ||
echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "all: \$(LIBRARY)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "\$(LIBRARY): \$(OBJS)" >> $2/Makefile | ||
echo " \$(CXX) -shared -o \$@ \$(OBJS)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "%.o: %.cpp" >> $2/Makefile | ||
echo " \$(CXX) \$(CXXFLAGS) -fPIC -o \$@ -c \$< " >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
echo "clean:" >> $2/Makefile | ||
echo " rm \$(OBJS) \$(LIBRARY)" >> $2/Makefile | ||
echo "" >> $2/Makefile | ||
|
||
# Generate 'Class1' header file | ||
echo "#pragma once" >> $2/Class1.h | ||
echo "" >> $2/Class1.h | ||
echo "namespace $3 {" >> $2/Class1.h | ||
echo "" >> $2/Class1.h | ||
echo "class Class1 {" >> $2/Class1.h | ||
echo "public:" >> $2/Class1.h | ||
echo " void hello();" >> $2/Class1.h | ||
echo "};" >> $2/Class1.h | ||
echo "" >> $2/Class1.h | ||
echo "}" >> $2/Class1.h | ||
echo "" >> $2/Class1.h | ||
|
||
# Generate 'Class1' source file | ||
echo "#include \"Class1.h\"" >> $2/Class1.cpp | ||
echo "#include <stdio.h>" >> $2/Class1.cpp | ||
echo "" >> $2/Class1.cpp | ||
echo "namespace $3 {" >> $2/Class1.cpp | ||
echo "" >> $2/Class1.cpp | ||
echo "void Class1::hello()" >> $2/Class1.cpp | ||
echo "{" >> $2/Class1.cpp | ||
echo " printf(\"Hello friends! :^)\\n\");" >> $2/Class1.cpp | ||
echo "}" >> $2/Class1.cpp | ||
echo "" >> $2/Class1.cpp | ||
echo "}" >> $2/Class1.cpp | ||
echo "" >> $2/Class1.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[HackStudioTemplate] | ||
Name=Empty Project | ||
Description=Template for creating an empty project with no files. | ||
Priority=100 | ||
IconName32x=empty |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.