Пример #1
0
  void apply (PrefSymbol sym)
    {
      if (changed) {
	  unmodified(); original = current;
	  pref_mgr().set_geometry (sym, current);
	}
    };
Пример #2
0
  void set_value (String value)
    {
      if (value == original)  // ie: reset 
	unmodified();
      else if (!changed)      // ie: first change
	modified();
      current = value;
    }
Пример #3
0
  void set_value (WindowGeometry &value)
    {
      if (value == original)  // ie: reset 
	unmodified();
      else if (!changed)      // ie: first change
	modified();
      current = value;
    }
Пример #4
0
EntnodeData *Entries_SetVisited(const char* path, EntnodeMap& entries, const char* name,
                                const struct stat& finfo, bool isDir, bool isReadOnly,
                                bool isMissing, const std::vector<std::string>* ignlist)
{
   TDEBUG_ENTER("Entries_SetVisited");
   bool isCvs = false;
   std::string lookupName;
   if (isDir)
   {
      TDEBUG_TRACE("Is dir");
      EntnodeDir *adata = new EntnodeDir(path, name);
      ENTNODE anode(adata);
      adata->UnRef();

      lookupName = anode.Data()->GetName();
      EntnodeMap::iterator it = entries.find(lookupName);
      isCvs = it != entries.end();
      if (!isCvs)
         entries[lookupName] = anode;
   }
   else
   {
      TDEBUG_TRACE("Is no dir");
      EntnodeFile *adata = new EntnodeFile(path, name);
      ENTNODE anode(adata);
      adata->UnRef();

      lookupName = anode.Data()->GetName();
      EntnodeMap::iterator it = entries.find(lookupName);
      isCvs = it != entries.end();
      if (!isCvs)
         entries[lookupName] = anode;
   }

   const ENTNODE & theNode = entries[lookupName];
   EntnodeData *data = ((ENTNODE *)&theNode)->Data();
   data->SetVisited(true);
   if (!isCvs)
   {
      data->SetUnknown(true);
      if (ignlist && MatchIgnoredList(name, *ignlist) || 
         finfo.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)
         data->SetIgnored(true);

      // the dir may have some cvs informations in it, despite the fact
      // that it is not referenced by the parent directory, so try
      // to figure it.

      if (!data->IsIgnored())
      {
         std::string cvsFile = path;
         cvsFile = EnsureTrailingDelimiter(cvsFile);
         cvsFile += name;
         cvsFile = EnsureTrailingDelimiter(cvsFile);
         cvsFile += "CVS";
         struct stat sb;
         TDEBUG_TRACE("Before stat");
         if (stat(cvsFile.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode))
         {
            data->SetUnknown(false);
         }
         TDEBUG_TRACE("After stat");
      }
   }

   data->SetReadOnly(isReadOnly);
   data->SetMissing(isMissing);

   if (isDir)
   {
      if (data->IsIgnored())
         data->SetDesc(_("Ignored Folder"));
      else if (data->IsUnknown())
         data->SetDesc(_("Non-CVS Folder"));
      else
         data->SetDesc(_("Folder"));
   }
   else if (!isMissing)
   {
      const char* ts = data->GetTS();

     TDEBUG_TRACE("Timestamp: " << (ts == 0 ? "NULL" : ts));
      // Revision "0" means "added"
      if (ts == 0)
      {
         data->SetUnmodified(true);
      }
      else if (strcmp(data->GetVN(), "0") == 0)
      {
         data->SetAdded(true);
         // Added files are always modified
         data->SetUnmodified(false);
      }
      else
      {
         data->SetUnmodified(unmodified(finfo, ts));
      }

      const char* ts_conflict = data->GetConflict();
      if (ts_conflict == 0)
         data->SetNeedsMerge(false);
      else
         data->SetNeedsMerge(unmodified(finfo,ts_conflict));

      data->SetLocked((finfo.st_mode & S_IWRITE) == 0);
      
      const char* info = 0;
      if (data->IsIgnored())
      {
         data->SetDesc(_("Ignored"));
      }
      else if (data->IsUnknown())
      {
         data->SetDesc(_("Non-CVS File"));
      }
      else if (data->NeedsMerge())
      {
         data->SetDesc(_("Conflict"));
      }
      else if ((info = data->GetOption()) != 0 && strcmp(info, "-kb") == 0)
      {
         data->SetDesc(data->IsUnmodified() ? _("Binary") : _("Mod. Binary"));
      }
      else
      {
         data->SetDesc(data->IsUnmodified() ? _("File") : _("Mod. File"));
      }
   }

   return data;
}