Skip to content

Commit 3daf9b7

Browse files
author
michal kowalski
committed
repository creation
1 parent be30387 commit 3daf9b7

75 files changed

Lines changed: 7074 additions & 0 deletions

Some content is hidden

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

LuaStudio/src/About.cpp

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
#include "StdAfx.h"
8+
#include "About.h"
9+
10+
11+
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
12+
{
13+
}
14+
15+
void CAboutDlg::DoDataExchange(CDataExchange* DX)
16+
{
17+
CDialog::DoDataExchange(DX);
18+
19+
DDX_Control(DX, IDC_TITLE, title_ctrl_);
20+
DDX_Text(DX, IDC_ABOUT_VER, version_string_);
21+
}
22+
23+
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
24+
ON_WM_ERASEBKGND()
25+
ON_WM_CTLCOLOR()
26+
END_MESSAGE_MAP()
27+
28+
29+
30+
BOOL CAboutDlg::OnInitDialog()
31+
{
32+
if (HRSRC rsrc= ::FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION))
33+
if (HGLOBAL global = ::LoadResource(AfxGetResourceHandle(), rsrc))
34+
{
35+
VS_FIXEDFILEINFO* ver= (VS_FIXEDFILEINFO *)((char *)::LockResource(global) + 0x28);
36+
if (ver->dwSignature == 0xfeef04bd)
37+
version_string_.Format(IDS_ABOUT_VER,
38+
(int)HIWORD(ver->dwProductVersionMS), (int)LOWORD(ver->dwProductVersionMS),
39+
(int)HIWORD(ver->dwProductVersionLS), (int)LOWORD(ver->dwProductVersionLS));
40+
41+
::FreeResource(global);
42+
}
43+
44+
about_.Attach(::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_ABOUT), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION));
45+
46+
CDialog::OnInitDialog();
47+
48+
LOGFONT lf;
49+
title_ctrl_.GetFont()->GetLogFont(&lf);
50+
51+
GetFont()->GetLogFont(&lf);
52+
// CClientDC dc(this);
53+
// lf.lfHeight = -MulDiv(9, dc.GetDeviceCaps(LOGPIXELSY), 96);
54+
lf.lfWeight = 700; // bold
55+
lf.lfHeight -= 2; // larger
56+
title_font_.CreateFontIndirect(&lf);
57+
title_ctrl_.SetFont(&title_font_);
58+
59+
web_page_link_.SubclassDlgItem(IDC_LINK, this, "http://lua-studio.luaforge.net");
60+
lua_org_link_.SubclassDlgItem(IDC_LINK_LUA, this, "http://www.lua.org/");
61+
62+
return true;
63+
}
64+
65+
66+
BOOL CAboutDlg::OnEraseBkgnd(CDC* dc)
67+
{
68+
CRect rect(0,0,0,0);
69+
GetClientRect(rect);
70+
71+
dc->FillSolidRect(rect, RGB(255,255,255)); // white to match image
72+
73+
// bitmap (x, y) location in the dialog
74+
CPoint pos(180, 40);
75+
76+
DIBSECTION bmp;
77+
if (about_.m_hObject && about_.GetObject(sizeof bmp, &bmp) && bmp.dsBm.bmBits)
78+
{
79+
dc->SetStretchBltMode(COLORONCOLOR);
80+
81+
::StretchDIBits(*dc, pos.x, pos.y, bmp.dsBm.bmWidth, bmp.dsBm.bmHeight,
82+
0, 0, bmp.dsBm.bmWidth, bmp.dsBm.bmHeight, bmp.dsBm.bmBits,
83+
reinterpret_cast<BITMAPINFO*>(&bmp.dsBmih), DIB_RGB_COLORS, SRCCOPY);
84+
}
85+
86+
return true;
87+
}
88+
89+
90+
HBRUSH CAboutDlg::OnCtlColor(CDC* dc, CWnd* wnd, UINT ctlColor)
91+
{
92+
if (wnd == &web_page_link_)
93+
return web_page_link_.CtlColor(dc, ctlColor);
94+
else if (wnd == &lua_org_link_)
95+
return lua_org_link_.CtlColor(dc, ctlColor);
96+
else
97+
return static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH));
98+
}

LuaStudio/src/About.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
/////////////////////////////////////////////////////////////////////////////
8+
// CAboutDlg dialog used for App About
9+
10+
#include "resource.h"
11+
#include "StaticLink.h"
12+
13+
14+
class CAboutDlg : public CDialog
15+
{
16+
public:
17+
CAboutDlg();
18+
19+
// Dialog Data
20+
//{{AFX_DATA(CAboutDlg)
21+
enum { IDD = IDD_ABOUTBOX };
22+
CStatic title_ctrl_;
23+
CString version_string_;
24+
//}}AFX_DATA
25+
26+
// ClassWizard generated virtual function overrides
27+
//{{AFX_VIRTUAL(CAboutDlg)
28+
protected:
29+
virtual void DoDataExchange(CDataExchange* DX); // DDX/DDV support
30+
//}}AFX_VIRTUAL
31+
32+
// Implementation
33+
protected:
34+
//{{AFX_MSG(CAboutDlg)
35+
virtual BOOL OnInitDialog();
36+
//}}AFX_MSG
37+
DECLARE_MESSAGE_MAP()
38+
39+
CStaticLink web_page_link_;
40+
CStaticLink lua_org_link_;
41+
CBitmap about_;
42+
CFont title_font_;
43+
44+
afx_msg BOOL OnEraseBkgnd(CDC* dc);
45+
afx_msg HBRUSH OnCtlColor(CDC* dc, CWnd* wnd, UINT ctl_color);
46+
};

LuaStudio/src/AllocMem.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
// Bezpieczny przydzielacz pamięci
8+
9+
10+
template<class T> class MemPtr : class CObject
11+
{
12+
T* ptr;
13+
14+
public:
15+
16+
MemPtr(size_t size= 1)
17+
{
18+
ASSERT(size>0);
19+
ptr = new T[size];
20+
}
21+
22+
~MemPtr()
23+
{ delete [] ptr; }
24+
25+
operator T* ()
26+
{ return ptr; }
27+
};

LuaStudio/src/App.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
#pragma once
7+
8+
9+
#include "Global.h"
10+
11+
#ifndef __AFXWIN_H__
12+
#error include 'stdafx.h' before including this file for PCH
13+
#endif
14+
15+
16+
/////////////////////////////////////////////////////////////////////////////
17+
// StudioApp:
18+
//
19+
20+
class StudioApp : public CWinApp
21+
{
22+
static const TCHAR REGISTRY_KEY[];
23+
static const TCHAR PROFILE_NAME[];
24+
HINSTANCE inst_res_;
25+
HMODULE rich_edit_;
26+
27+
public:
28+
static bool maximize_; // maximize editor window at start-up
29+
static bool file_new_; // open new empty doc at start-up
30+
CGlobal global_;
31+
bool do_not_add_to_recent_file_list_;
32+
33+
StudioApp();
34+
35+
// Overrides
36+
public:
37+
virtual BOOL InitInstance();
38+
virtual void AddToRecentFileList(LPCTSTR path_name);
39+
virtual int ExitInstance();
40+
41+
// Implementation
42+
43+
afx_msg void OnAppAbout();
44+
DECLARE_MESSAGE_MAP()
45+
};
46+
47+
48+
extern StudioApp theApp;

LuaStudio/src/Broadcast.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
#include "stdafx.h"
8+
#include "MainFrm.h"
9+
10+
11+
// wys³anie komunikatu do wszystkich okien otwartych dokumentów
12+
void CBroadcast::SendMessageToViews(UINT msg, WPARAM wParam/*= 0*/, LPARAM lParam/*= 0*/)
13+
{
14+
CWinApp *app= AfxGetApp();
15+
POSITION posTempl= app->GetFirstDocTemplatePosition();
16+
while (posTempl != NULL)
17+
{
18+
CDocTemplate *templ= app->GetNextDocTemplate(posTempl);
19+
POSITION posDoc= templ->GetFirstDocPosition();
20+
while (posDoc != NULL)
21+
{
22+
CDocument *doc= templ->GetNextDoc(posDoc);
23+
POSITION posView = doc->GetFirstViewPosition();
24+
while (posView != NULL)
25+
{
26+
CView* view = doc->GetNextView(posView);
27+
view->SendMessage(msg,wParam,lParam);
28+
}
29+
}
30+
}
31+
}
32+
33+
34+
// wys³anie komunikatu do okien zapisanych w g_windows[]
35+
void CBroadcast::SendMessageToPopups(UINT msg, WPARAM wParam/*= 0*/, LPARAM lParam/*= 0*/)
36+
{
37+
for (int i=0; CMainFrame::windows_[i]; i++)
38+
{
39+
HWND wnd= *CMainFrame::windows_[i];
40+
if (wnd && ::IsWindow(wnd))
41+
::SendMessage(wnd, msg, wParam, lParam);
42+
}
43+
}

LuaStudio/src/Broadcast.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
#ifndef _broadcast_
8+
#define _broadcast_
9+
10+
11+
class CBroadcast
12+
{
13+
public:
14+
enum WinMsg
15+
{
16+
WM_USER_OFFSET = WM_APP + 0x100,
17+
WM_USER_EXIT_DEBUGGER = WM_USER_OFFSET,
18+
WM_USER_START_DEBUGGER,
19+
WM_USER_UPDATE_REG_WND,
20+
WM_USER_PROG_MEM_CHANGED,
21+
WM_USER_REMOVE_ERR_MARK,
22+
WM_USER_NEW_LINE,
23+
WM_APP_OUTPUT
24+
};
25+
26+
static void SendMessageToViews(UINT msg, WPARAM wParam= 0, LPARAM lParam= 0);
27+
static void SendMessageToPopups(UINT msg, WPARAM wParam= 0, LPARAM lParam= 0);
28+
};
29+
30+
#endif
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
#include "StdAfx.h"
8+
#include "CXMultiDocTemplate.h"
9+
10+
bool CXMultiDocTemplate::registration_ext_= true;
11+
12+
13+
BOOL CXMultiDocTemplate::GetDocString(CString& string, enum DocStringIndex i) const
14+
{
15+
if (!CMultiDocTemplate::GetDocString(string, i))
16+
return false;
17+
18+
if (i == filterExt)
19+
{
20+
if (registration_ext_)
21+
if (string.GetLength() > 4)
22+
string = string.Left(4);
23+
}
24+
25+
return true;
26+
}

LuaStudio/src/CXMultiDocTemplate.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*-----------------------------------------------------------------------------
2+
Lua Studio
3+
4+
Copyright (c) 1996-2008 Michal Kowalski
5+
-----------------------------------------------------------------------------*/
6+
7+
// zmodyfikowana klasa CMultiDocTemplate - zamieniona funkcja rozpoznaj¹ca
8+
// otwierane dokumenty
9+
10+
class CXMultiDocTemplate: public CMultiDocTemplate
11+
{
12+
bool normal_match_;
13+
14+
public:
15+
CXMultiDocTemplate(UINT id_resource, CRuntimeClass* doc_class,
16+
CRuntimeClass* frame_class, CRuntimeClass* view_class, bool normal_match= true) :
17+
normal_match_(normal_match),
18+
CMultiDocTemplate(id_resource,doc_class,frame_class,view_class)
19+
{}
20+
virtual ~CXMultiDocTemplate()
21+
{}
22+
23+
virtual Confidence MatchDocType(LPCTSTR path_name, CDocument*& rpDocMatch)
24+
{
25+
if (normal_match_)
26+
return CMultiDocTemplate::MatchDocType(path_name,rpDocMatch);
27+
else
28+
return CDocTemplate::noAttempt;
29+
}
30+
31+
virtual BOOL GetDocString(CString& string, enum DocStringIndex i) const;
32+
33+
static bool registration_ext_;
34+
};

0 commit comments

Comments
 (0)