Page 1 of 1

patch fo made_deb.sh and some others

Posted: Sun Jan 09, 2011 5:51 pm
by fanhe0513

Code: Select all

Index: make_deb.sh
===================================================================
--- make_deb.sh	(revision 4689)
+++ make_deb.sh	(working copy)
@@ -79,9 +79,36 @@
 if [ "\$1" = "configure" ] && [ -x "\`which update-menus 2>/dev/null\`" ]; then
     update-menus
 fi
+## Update mime database
+if [ "\$1" = "configure" ] && [ -x "\`which update-mime-database 2>/dev/null\`" ]; then
+	update-mime-database ${PREFIX}/share/mime
+fi
+## Update mime icon
+if [ "\$1" = "configure" ] && [ -x "\`which update-icon-caches 2>/dev/null\`" ]; then
+	update-icon-caches ${PREFIX}/share/icons/hicolor
+fi
 echo "Done"
 EOF
+    cat > fakeroot/DEBIAN/postrm <<EOF
+#!/bin/sh
+echo "Running postrm step..."
+
+## Menu updating
+if [ "\$1" = "configure" ] && [ -x "\`which update-menus 2>/dev/null\`" ]; then
+    update-menus
+fi
+## Update mime database
+if [ "\$1" = "configure" ] && [ -x "\`which update-mime-database 2>/dev/null\`" ]; then
+	update-mime-database ${PREFIX}/share/mime
+fi
+## Update mime icon
+if [ "\$1" = "configure" ] && [ -x "\`which update-icon-caches 2>/dev/null\`" ]; then
+	update-icon-caches ${PREFIX}/share/icons/hicolor
+fi
+echo "Done"
+EOF
     chmod 0755 fakeroot/DEBIAN/postinst
+    chmod 0755 fakeroot/DEBIAN/postrm
 }
 
 ## Making destop file
@@ -185,6 +212,14 @@
 cp -pr AUTHORS fakeroot/${PREFIX}/share/codelite/
 cp -pr COPYING fakeroot/${PREFIX}/share/codelite/
 
+## Support mime type
+mkdir -p fakeroot/${PREFIX}/share/mime/packages/
+mkdir -p fakeroot/${PREFIX}/share/icons/hicolor/32x32/mimetypes
+
+cp -pr codelite.xml fakeroot/${PREFIX}/share/mime/packages/
+cp -pr Runtime/images/cubes.png fakeroot/${PREFIX}/share/icons/hicolor/32x32/mimetypes/application-x-codelite-project.png
+cp -pr Runtime/images/cubes.png fakeroot/${PREFIX}/share/icons/hicolor/32x32/mimetypes/application-x-codelite-workspace.png
+
 chmod 0644 fakeroot/${PREFIX}/lib/codelite/debuggers/*.so
 chmod 0644 fakeroot/${PREFIX}/lib/codelite/*.so
 chmod 0666 fakeroot/${PREFIX}/share/codelite/codelite-icons.zip
main aim is that support workspace and project mime for linux.
And, .workspace will use cudes.png as the mime icon, so as .project because I can't find another icon suit .project, you can consider add a project icon.

finally, a mime file and a screenshot below.

--------------------------------------------------------------------
I really want to develop a vim plugin for codelite, is there any document about plugins?

Re: patch fo made_deb.sh and some others

Posted: Sun Jan 09, 2011 6:00 pm
by fanhe0513
Another, but I think eranif you will not apply it, it just for my custom(see http://codelite.org/forum/viewtopic.php?f=3&t=1189 point 1)
And it such the design is not so accuracy, because "false); // do not automatically insert word if there is only single choice" will not work.

It is the change, I just add an argument...

Code: Select all

Index: LiteEditor/context_cpp.cpp
===================================================================
--- LiteEditor/context_cpp.cpp	(revision 4689)
+++ LiteEditor/context_cpp.cpp	(working copy)
@@ -2224,7 +2224,8 @@
 			                            word,   // partial word
 			                            false,  // dont show full declaration
 			                            true,   // auto hide if there is no match in the list
-			                            false); // do not automatically insert word if there is only single choice
+			                            false,  // do not automatically insert word if there is only single choice
+										true);	// ignore "Auto-Insert single match" option
 		}
 	}
 }
Index: LiteEditor/cl_editor.h
===================================================================
--- LiteEditor/cl_editor.h	(revision 4689)
+++ LiteEditor/cl_editor.h	(working copy)
@@ -470,7 +470,7 @@
 	 * @param word part of the word
 	 * @param showFullDecl display full function declaration
 	 */
-	void ShowCompletionBox(const std::vector<TagEntryPtr> &tags, const wxString &word, bool showFullDecl, bool autoHide = false, bool autoInsertSingleChoice = true);
+	void ShowCompletionBox(const std::vector<TagEntryPtr> &tags, const wxString &word, bool showFullDecl, bool autoHide = false, bool autoInsertSingleChoice = true, bool ignoreAutoInsertSingleOpt = false);
 
 	/**
 	 * @brief displays teh code completion box. Unlike the previous metho, this method accepts owner and sends an event once selection is made
Index: LiteEditor/cl_editor.cpp
===================================================================
--- LiteEditor/cl_editor.cpp	(revision 4689)
+++ LiteEditor/cl_editor.cpp	(working copy)
@@ -2963,7 +2963,7 @@
 	m_ccBox->Show(tags, word, false, owner);
 }
 
-void LEditor::ShowCompletionBox(const std::vector<TagEntryPtr>& tags, const wxString& word, bool showFullDecl, bool autoHide, bool autoInsertSingleChoice)
+void LEditor::ShowCompletionBox(const std::vector<TagEntryPtr>& tags, const wxString& word, bool showFullDecl, bool autoHide, bool autoInsertSingleChoice, bool ignoreAutoInsertSingleOpt)
 {
 	if ( m_ccBox == NULL ) {
 		// create new completion box
@@ -2978,7 +2978,7 @@
 	}
 
 	m_ccBox->SetAutoHide(autoHide);
-	if (TagsManagerST::Get()->GetCtagsOptions().GetFlags() & CC_AUTO_INSERT_SINGLE_CHOICE)
+	if ((TagsManagerST::Get()->GetCtagsOptions().GetFlags() & CC_AUTO_INSERT_SINGLE_CHOICE) && !ignoreAutoInsertSingleOpt)
 		m_ccBox->SetInsertSingleChoice(true);
 	else
 		m_ccBox->SetInsertSingleChoice(false);

Re: patch fo made_deb.sh and some others

Posted: Sun Jan 09, 2011 8:09 pm
by eranif
Thanks for the mime type patch - applied.

About the plugin:

I wrote a small article in the wiki that should help you getting started with writing the plugin.
http://codelite.org/LiteEditor/CreatingNewPlugin

This will create the skeleton plugin, from this point the best thing is to open some other plugins and see how its done. Another good choice is ask your questions in the forum / IRC (better IRC)

codelite IRC:
#codelite at irc.freenode.net

Eran