. Dangeun 모듈

메인 모듈인만큼 많은 기능이 포함되어 있고 각 기능별로 여덟 개의 모듈로 나누어진다. 함수와 관련 구조체, 열거형 등을 해당 모듈로 이동시키기만 하면 된다. 어떤 기준으로 이런 모듈을 나누었는지는 모듈 이름으로 쉽게 유추할 수 있을 것이다. 다음은 Dangeun 모듈로부터 파생된 모듈의 헤더 파일들이다. 각 모듈이 어떤 함수와 타입 선언문을 나누어 가졌는지 일목 요연하게 살펴볼 수 있다.

 

Config.h

FileWnd.h

#ifndef __CONFIG_H

#define __CONFIG_H

 

void Config();

void DgEnumFonts();

int CALLBACK EnumFamCallBack(ENUMLOGFONT *, NEWTEXTMETRIC *, int, LPARAM);

int CALLBACK ConfigProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);

BOOL CALLBACK GeneralDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK ViewDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK ColorDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK EditDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK SyntaxDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK PrintDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

void ApplyNow();

void SetSetting(CApiEdit &Ae);

void AdjustDlgUI(int Page,HWND hDlg);

void InitSysColor();

COLORREF& GetColorFromID(int ID);

 

struct arColor

{

          TCHAR Name[16];

          COLORREF Color;

};

 

#endif // __CONFIG_H

#ifndef __FILEWND_H

#define __FILEWND_H

 

enum {DGI_DRIVE, DGI_DRIVESEL, DGI_FOLDER, DGI_FOLDERSEL, DGI_FILE, DGI_FILESEL,

          DGI_PROJECT, DGI_PROJECTSEL, DGI_SUB, DGI_SUBSEL};

 

LRESULT CALLBACK DGFileProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL IsDirEmpty(TCHAR *Path);

HTREEITEM FindInsAfter(HTREEITEM hParent, int iImage, TCHAR *Name);

int OnFindNode(TCHAR *Path,DWORD Attr,LPVOID pCustom);

void GetNodePath(HTREEITEM pNode, TCHAR *Path);

void InitTree();

void GetCurrentFolder(TCHAR *Path);

void GotoFolderInTree(TCHAR *Path);

void RefreshTree();

 

#endif // __FILEWND_H

 

Find.h

Internet.h

#ifndef __FIND_H

#define __FIND_H

 

void RefillHistory(HWND hCombo, CHistory &Hist);

BOOL CALLBACK FindDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK GotoLineDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

LRESULT CALLBACK DGOutputProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK FileFindDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

void FindOrReplaceInFiles(BOOL bReplace);

int OnFindFile(TCHAR *Path,DWORD Attr,LPVOID pCustom);

void GetLineNumAndText(TCHAR *szBuf, TCHAR *ptr, TCHAR *Text, int &line, int &col);

BOOL IsDelimiter(TCHAR t);

int OnReplaceFile(TCHAR *Path, DWORD Attr, LPVOID pCustom);

void OpenFileFromOutput(int idx);

void CopyOutputToText();

void SendOutputToWindow();

void ExtractOutputToText(TCHAR *&buf);

DWORD WINAPI FIFThread(LPVOID pCallback);

BOOL TestFIFThread();

 

#endif // __FIND_H

#ifndef __INTERNET_H

#define __INTERNET_H

 

struct FtpInfo

{

          TCHAR Name[32];

          TCHAR Addr[256];

          TCHAR User[32];

          TCHAR Pass[32];

          int Port;

};

 

BOOL CALLBACK DGHttpProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

int DgHttpDown(TCHAR *URL, TCHAR *&Text);

BOOL CALLBACK DGDownProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK DGFtpConfigProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK DGFtpProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL DgFtpConnect(TCHAR *Server, TCHAR *User, TCHAR *Pass, int Port);

void DgFtpUnConnect();

void DgFtpAddFile(HWND hDlg,WIN32_FIND_DATA wfd);

void DgFtpEnumFiles(HWND hDlg);

void LoadFtpServerList(HWND hDlg);

int DgFtpDown(TCHAR *Path, TCHAR *&Text);

BOOL DgFtpUp(TCHAR *Path, TCHAR *Text);

 

#endif // __INTERNET_H

 

Print.h

ToolBar.h

#ifndef __PRINT_H

#define __PRINT_H

 

void Print(HWND hChild);

void PrintDirect(HWND hChild);

BOOL PrintDoc(HWND hChild, HDC pdc, int nPages, int nCopies, int nFirst, int nFinal);

LRESULT CALLBACK DgPrintingProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

BOOL CALLBACK AbortProc(HDC hPrtdc, int iError);

void PrintFormatText(TCHAR *szFormat,Ae_PrintInfo *pi,TCHAR *Path,int nPage,int y);

void TextReplace(TCHAR *Text,TCHAR *what,TCHAR *to);

 

#endif // __PRINT_H

#ifndef __TOOLBAR_H

#define __TOOLBAR_H

 

void CreateToolBar(BOOL bText, BOOL bBig);

void SetStatusPart();

void SetStatusText(int mask,LPCTSTR Mes=NULL);

LRESULT CALLBACK DGTabProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam);

void AddFileTab(TCHAR *Path);

int FindFileTab(TCHAR *Path);

void ChangeFileTab(int idx, TCHAR *Path);

void DeleteFileTab(TCHAR *Path);

 

#endif // __TOOLBAR_H

 

Dangeun.h

Project.h

#ifndef __DANGEUN_H

#define __DANGEUN_H

 

LRESULT CALLBACK DGWndProc(HWND,UINT,WPARAM,LPARAM);

LRESULT CALLBACK DGChildProc(HWND,UINT,WPARAM,LPARAM);

int OnCreate(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnDestroy(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnTimer(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnCommand(HWND hWnd,WPARAM wParam,LPARAM lParam);

BOOL OnClose(HWND hWnd,WPARAM wParam,LPARAM lParam);

BOOL OnQueryEndSession(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnInitMenu(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnDropFiles(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnFontChange(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnActivateApp(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnUser1(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnUser2(HWND hWnd,WPARAM wParam,LPARAM lParam);

BOOL OnSize(HWND hWnd,WPARAM wParam,LPARAM lParam);

BOOL OnSetCursor(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnLButtonDown(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnMouseMove(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnLButtonUp(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnNotify(HWND hWnd,WPARAM wParam,LPARAM lParam);

void OnIdle();

void OnSysColorChange(HWND hWnd,WPARAM wParam,LPARAM lParam);

 

BOOL CALLBACK AboutProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

HWND New();

void Open();

BOOL OpenFromFile(TCHAR *Path, BOOL bReadOnly=FALSE, BOOL bBrowse=FALSE);

BOOL OpenFileToChild(HWND hChild, TCHAR *Path);

BOOL Save(HWND hChild);

BOOL SaveAs(HWND hChild);

BOOL SaveToFile(HWND hChild,TCHAR *Path);

int ConfirmSave(HWND hChild);

HWND FindChildWithFile(TCHAR *path);

BOOL TestNeedActive(WORD ID);

void RevertFile(HWND hChild);

void SaveAll();

void CloseAll();

void RegisterPopup(BOOL bReg);

void ActivateBrood();

BOOL CALLBACK SetupDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK UninstallDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

void Uninstall();

void SelectParser(CApiEdit &Ae,TCHAR *path);

void Relayout();

void GetChildSize(int &t,int &s,int &f,int &o,int &w);

HWND NewChild();

void PrintInfo(CApiEdit &Ae);

 

struct SInfo

{

          CApiEdit Ae;

          TCHAR NowFile[MAX_PATH];

};

 

struct FileInfo

{

          HWND hWnd;

          DWORD size;

          FILETIME st;

};

 

#endif // __DANGEUN_H

#ifndef __PROJECT_H

#define __PROJECT_H

 

enum {DGP_SUB=1, DGP_FILE, DGP_FOLDER};

 

struct ProjectHeader

{

          TCHAR Text[64];

          int Ver;

          TCHAR Name[32];

          TCHAR Desc[128];

          BOOL bAbsolute;

};

 

struct ProjectRecord

{

          int Parent;

          BYTE Type;

          TCHAR Path[400];

};

 

BOOL CALLBACK DgProjectProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL CALLBACK DgNewProjectProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);

BOOL OpenProject(HWND hDlg,TCHAR *Project,BOOL &bAbsolute);

void InsertProjectRecord(HWND hTree,ProjectRecord *data,HTREEITEM pNode,int pid);

void AddFileToProject(HWND hDlg,TCHAR *Path,BOOL bAbsolute);

void SaveProject(HWND hDlg, TCHAR *Project);

void SaveProjectRecord(HWND hDlg, HANDLE hFile,HTREEITEM hParent,int pid);

BOOL LoadProject(TCHAR *Project,BOOL bUpdate);

HTREEITEM FindTreeItem(HWND hTree, HTREEITEM hParent, TCHAR *Text);

int GetProjectNodePath(HWND hDlg,HWND hPrjTree,HTREEITEM hItem,TCHAR *Path);

BOOL TestProjectValid(HWND hDlg, HTREEITEM hParent);

HTREEITEM CopyTreeItem(HWND hTree, HTREEITEM hSrc, HTREEITEM hDest, BOOL bNext);

HTREEITEM CopyTreeItems(HWND hTree, HTREEITEM hSrc, HTREEITEM hDest,BOOL bNext);

void RePathProject(HANDLE hFile,TCHAR *Project,BOOL bAbsolute);

 

#endif // __PROJECT_H

 

각 모듈의 구현 파일들은 Dangeun.cpp에 있던 함수의 본체를 나누어 가진다. 단순히 나누는 것이기 때문에 코드는 수정할 필요가 전혀 없다. 메인 모듈인 Dangeun에는 메인 윈도우의 메시지 처리 함수와 파일 입출력함수, 설치 관련 함수들만 남았다.