Skip to content

Commit

Permalink
Re-add the ability to export grayscale images ...
Browse files Browse the repository at this point in the history
Also make changing the version easier.
  • Loading branch information
Tyler J. Drake committed Sep 26, 2018
1 parent fb24e60 commit 102620a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ cmake_minimum_required(VERSION 3.8)
project(CedarLogic)


set(CEDARLOGIC_MAJOR 2)
set(CEDARLOGIC_MINOR 3)
set(CEDARLOGIC_PATCH 5)

add_definitions(
-DCEDARLOGIC_MAJOR=${CEDARLOGIC_MAJOR}
-DCEDARLOGIC_MINOR=${CEDARLOGIC_MINOR}
-DCEDARLOGIC_PATCH=${CEDARLOGIC_PATCH}
)


###
### *.cpp and *.h files
###
Expand Down Expand Up @@ -221,9 +232,9 @@ set(CPACK_PACKAGE_NAME "CedarLogic")
# UPDATE: You can change 'bin' to '.' by setting CPACK_NSIS_EXECUTABLES_DIRECTORY.
set(CPACK_PACKAGE_EXECUTABLES ..\\\\CedarLogic "CedarLogic" ..\\\\Uninstall "Uninstall CedarLogic")
set(CPACK_PACKAGE_VENDOR "Cedarville University")
set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "3")
set(CPACK_PACKAGE_VERSION_PATCH "4")
set(CPACK_PACKAGE_VERSION_MAJOR "${CEDARLOGIC_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${CEDARLOGIC_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${CEDARLOGIC_PATCH}")
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/cmake\\\\InstallSmall.bmp)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/res/LICENSE.txt)
set(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/cmake\\\\icon.ico)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ CedarLogic is Cedarville University's digital logic simulator.
Run `git tag` to view all the tagged versions of CedarLogic.

v2.2017.01.16 - Buggy first release with busses.

v2.2017.01.18 - Fixed bugs.

v2.2017.05.02 - Borken version with lots of good, but enough bad to warrant abandonment.

v2.2018.01.26 - Branch from v2.2017.01.18, stable bus support with an installer and file associations.
14 changes: 14 additions & 0 deletions src/gui/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ void MainFrame::OnPaste(wxCommandEvent& event) {
}

void MainFrame::OnExportBitmap(wxCommandEvent& event) {

bool showGrid = false;
wxMessageDialog gridDialog(this, "Export with Grid?", "Export", wxYES_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION);
switch (gridDialog.ShowModal()) {
Expand All @@ -743,7 +744,20 @@ void MainFrame::OnExportBitmap(wxCommandEvent& event) {
return;
}

bool showColor = false;
wxMessageDialog colorDialog(this, "Export with Color?", "Export", wxYES_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION);
switch (colorDialog.ShowModal()) {
case wxID_YES:
showColor = true;
break;
case wxID_CANCEL:
return;
}

wxBitmap bitmap = getBitmap(showGrid);
if (!showColor) {
bitmap = wxBitmap(bitmap.ConvertToImage().ConvertToGreyscale());
}

wxString caption = "Export Circuit";
wxString wildcard = "PNG (*.png)|*.png|JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|Bitmap (*.bmp)|*.bmp";
Expand Down
9 changes: 6 additions & 3 deletions src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
using namespace std;

namespace {
const int VERSION_MAJOR = 2;
const int VERSION_MINOR = 3;
const int VERSION_MAJOR = CEDARLOGIC_MAJOR;
const int VERSION_MINOR = CEDARLOGIC_MINOR;
const int VERSION_PATCH = CEDARLOGIC_PATCH;
}

string VERSION_NUMBER_STRING() {
Expand Down Expand Up @@ -40,7 +41,8 @@ string VERSION_NUMBER_STRING() {

// Version in format: "MAJOR.MINOR|YYYY-MM-DD HH:MM:SS"
return std::to_string(VERSION_MAJOR) + "." +
std::to_string(VERSION_MINOR) + " | " +
std::to_string(VERSION_MINOR) + "." +
std::to_string(VERSION_PATCH) + " | " +
year + "-" + month + "-" + day + " " + hms;
}

Expand All @@ -55,6 +57,7 @@ string VERSION_ABOUT_TEXT() {
R"===(
Copyright (c) 2007, Cedarville University, Benjamin Sprague, Matthew Lewellyn, David Knierim, Joshua Lansford, Nathan Harro.
Copyright (c) 2017, Cedarville University, Tyler Drake, Julian Pernia, Jackson Vaugn, Colin Broberg.
Copyright (c) 2018, Cedarville University, Tyler Drake.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down

0 comments on commit 102620a

Please sign in to comment.