Skip to content

Commit

Permalink
Remove st_version.h
Browse files Browse the repository at this point in the history
The library only cares about file format version.
The editor now get the info from application resources.

Fixes #3.
  • Loading branch information
pulkomandy committed Dec 12, 2020
1 parent 5572f50 commit a39f70d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
22 changes: 19 additions & 3 deletions Source/stAboutView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
Distributed under the terms of the MIT Licence. */

#include <Application.h>
#include <AppFileInfo.h>
#include <File.h>
#include <Roster.h>
#include <Screen.h>
#include <Window.h>
#include <stdio.h>

#include "stAboutView.h"
#include "st_version.h"

stBmView::stBmView(BRect rect, BBitmap *bm):
BView(rect,"name", B_FOLLOW_NONE , B_WILL_DRAW )
Expand All @@ -17,12 +19,26 @@ stBmView::stBmView(BRect rect, BBitmap *bm):
SetLowColor(0,0,0);
SetHighColor(255,255,255);

sprintf(verstr,"%.1f",(float)ST_CURRENT_EDITOR_VERSION/1000.0);
app_info info;
be_app->GetAppInfo(&info);
BFile file(&info.ref, B_READ_ONLY);
BAppFileInfo appMime(&file);
version_info versionInfo;
if (appMime.GetVersionInfo(&versionInfo, B_APP_VERSION_KIND) == B_OK) {
if (versionInfo.major == 0 && versionInfo.middle == 0
&& versionInfo.minor == 0) {
return;
}

sprintf(verstr,"%" B_PRId32 ".%" B_PRId32 ".%" B_PRId32,
versionInfo.major, versionInfo.middle, versionInfo.minor);
}

}
void stBmView::Draw(BRect r)
{
DrawBitmap(m_bm, r, r);
DrawString(verstr, BPoint(1,8));
DrawString(verstr, BPoint(1, 10));
}
void stBmView::MouseDown(BPoint)
{
Expand Down
2 changes: 0 additions & 2 deletions lib/headers/stSong.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Distributed under the terms of the MIT Licence. */
#include "ins_part_channel.h"
#include "txt.h"

#include "st_version.h"

#include "stlimits.h"

// välj vad som skall kompileras
Expand Down
10 changes: 0 additions & 10 deletions lib/headers/st_version.h

This file was deleted.

1 change: 0 additions & 1 deletion lib/source/ins_part_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Distributed under the terms of the MIT Licence. */

#include "ins_part_channel.h"
#include "txt.h"
#include "st_version.h"
#include "stlimits.h"

Ins::Ins(){
Expand Down
3 changes: 3 additions & 0 deletions lib/source/song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Distributed under the terms of the MIT Licence. */
#include "txt.h"
#include "player.h"

// Remember to update this if the file format changes!
#define ST_CURRENT_FILE_VERSION 1200

void *CALLOC(int s1, int s2);
void *CALLOC(int s1, int s2)
{
Expand Down

0 comments on commit a39f70d

Please sign in to comment.