⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 project.cpp

📁 一个完整的编辑器的代码(很值得参考
💻 CPP
字号:

#include "stdafx.h"
#include "editcmd.h"
#include "resource.h"
#include "project.h"
#include "filesup.h"
	
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#pragma warning ( disable : 4711 )
/////////////////////////////////////////////////////////////////////////////

CProject *g_pProject;

IMPLEMENT_DYNAMIC (CProject, CObject)

CProject::CProject () : CObject (), lstItems (10, TRUE), dwFlags (0)
  {
  }

CProject::~CProject ()
  {
  }

void CProject::RemoveItems (POSITION pos)
  {
    CProjectItem *pParent = lstItems.GetAt (pos);
    if (pParent)
      {
        lstItems.RemoveAt (pos);
        if (!pParent->lstItems.IsEmpty ())
          {
            pos = pParent->lstItems.GetHeadPosition ();
            ASSERT (pos);
            CProjectItem *pItem;
            POSITION pos2;
            do
              {
                pItem = pParent->lstItems.GetNext (pos);
                pos2 = lstItems.Find (pItem);
                if (pos2)
                  RemoveItems (pos2);
              }
            while (pos);
          }
        delete pParent;
      }
  }

bool CProject::IsModified ()
  {
    return dwFlags & PR_MODIFIED;
  }

void CProject::SetModified (BOOL bModified /*= TRUE*/)
  {
    if (bModified)
      dwFlags |= PR_MODIFIED;
    else
      dwFlags &= ~PR_MODIFIED;
  }

CString CProject::MakePath (CProjectItem *pItem)
  {
    CString sItem = pItem->sPath;
    int nLen = sItem.GetLength ();
    if (nLen < 2 || sItem[1] != _T (':'))
      sItem = GetPath (sPath, TRUE) + pItem->sMidPath + sItem;
    return sItem;
  }

bool CProject::New ()
  {
    sPath.Empty ();
    lstItems.RemoveAll ();
    return true;
  }

/////////////////////////////////////////////////////////////////////////////
#pragma warning ( default : 4711 )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -