Forums

Sublime Text 2 instead of IDE

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Sublime Text 2 instead of IDE

Postby kolesiko » Wed Oct 30, 2013 12:36 am

I am learning C# and it liked me at first. More precisely, I really like it even now. But when I had to write real programs, not the case studies, the Visual Studio Express restrictions investigated. I've installed .NET 4, Nunit, SharpDevelop, met already installed Git... And then realized that I just cut yak.

I found the language that makes these tools unnecessary. Programming for me not a hobby, I hope to earn money this way, so I need tools for unit-tests and backups. However, I do not work for hire, so I do not need tools for team collaboration and I am not bound hand and foot by corporate standards. Git can be replaced with Cubby, everything else are exist in Cobra.

I do not want to use a IDE. I want to code in Sublime Text 2, especially because I already have experience developing in this style (in Python).

Is it possible scenario for Cobra? How to do it? I do not need almost anything beyond the standard capabilities of .NET. The only exception is a commercial library for OCR. I suspect that I will have to compile from the command line or batch file. It's not as scary because I'm not going to write a lot of programs. In the pop-culture of 1980s often met "singer of one hit". So, I want to be a programmer of one application. 8-)

By the way, this is my first attempt to write something in Cobra. I have not tried to compile it. The abundance of installations are tired me.

"""
Virtual window is rectangular part of screen. For example, 32x32 pixels.
You can take a screenshot of such size by specifying a starting point.
"""

class VirtualWindow

var _window as Bitmap
var _gdi as Graphics

cue init(width as int, height as int)
assert width > 0 and width <= Screen.PrimaryScreen.WorkingArea.X
assert height > 0 and height <= Screen.PrimaryScreen.WorkingArea.Y
_window = Bitmap(width, height)
_gdi = Graphics.FromImage(_window)

def takeScreenshot(x as int, y as int)
assert x+width <= Screen.PrimaryScreen.WorkingArea.X
assert y+height <= Screen.PrimaryScreen.WorkingArea.Y
_gdi.CopyFromScreen(x, y, 0, 0, _window.Size)
return _window
kolesiko
 
Posts: 1

Re: Sublime Text 2 instead of IDE

Postby Charles » Wed Oct 30, 2013 8:54 pm

Sublime Text support was uploaded about 9 months ago by BOOMER:
http://cobra-language.com/trac/cobra/wiki/SublimeText

Looks like you are writing a WinForms app. If so, we have a How To here:
http://cobra-language.com/how-to/WinForms/

I mention this because I don't see a "use" clause in your example.

WPF is Microsoft's current GUI framework. An example for that is here:
http://cobra-language.com/how-to/WPF/

Regarding compiling from the command line or batch file, when I work outside an IDE, I often have scripts like:

build.cmd
run.cmd
test.cmd
clean.cmd

Depending on your editor, you may be able to bind these to keystrokes and/or menu items. If not, have a command prompt open and Alt+Tab between them.

Here are some actual scripts to give an example:

build.cmd
Code: Select all
@IF NOT EXIST build ( mkdir build )
del /q build\*.*
call cobra -c -d -timeit -color ^
  -out:build\cobra-pad.exe ^
  -lib:lib ^
  -ref:ICSharpCode.AvalonEdit.dll -ref:FindReplace.dll ^
  -copy-core ^
  %* ^
  ..\helpers\Cobra.Data.cobra ^
  ..\helpers\Id.cobra ^
  ..\helpers\ExceptionExtensions.cobra ^
  ..\helpers\GlobTool.cobra ^
  ..\helpers\MruList.cobra ^
  ..\helpers\Status.cobra ^
  ..\helpers\StringExtensions.cobra ^
  ..\helpers\Utils.cobra ^
  ..\models\Declaration.cobra ^
  ..\models\FileType.cobra ^
  ..\models\Program.cobra ^
  ..\models\Project.cobra ^
  ..\models\Message.cobra ^
  ..\models\BuildOutputParser.cobra ^
  helpers\ObjectInspector.cobra ^
  wpf-extensions.cobra ^
  cobra-pad.cobra ^
  avalon-editor.cobra
@copy app-icon.png build\
@copy *.xsdh build\
@copy introduction.rtf build\
@copy lib\*.* build\
dir build\


run.cmd
Code: Select all
@cls
@build\cobra-pad.exe %*%


In terms of file management:
-- I use Dropbox to sync files between machines and as a simple backup system. There are lots of choices in this category.
-- I use Mozy for my comprehensive backups. Lots of choices here too.
-- I use TortoiseHg for source control. I love reviewing diffs to see what I've changed, understand why I broke something, etc.

HTH
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 25 guests

cron