Переход на новые либы и ссылки к репозиториям #1

This commit is contained in:
Igor Timofeev 2018-05-19 00:37:41 +03:00
parent 00f19b2c46
commit 70a5bc234a
128 changed files with 3728 additions and 11792 deletions

File diff suppressed because it is too large Load Diff

View File

@ -174,13 +174,13 @@ local function drawShapeNumbers(x, y)
end
local function toolBarInfoLine(y, text)
buffer.square(xToolbar, y, widthOfToolbar, 1, colors.toolbarInfoBackground, 0xFFFFFF, " ")
buffer.text(xToolbar + 1, y, colors.toolbarInfoText, text)
buffer.drawRectangle(xToolbar, y, widthOfToolbar, 1, colors.toolbarInfoBackground, 0xFFFFFF, " ")
buffer.drawText(xToolbar + 1, y, colors.toolbarInfoText, text)
end
local function centerText(y, color, text)
local x = math.floor(xToolbar + widthOfToolbar / 2 - unicode.len(text) / 2)
buffer.text(x, y, color, text)
buffer.drawText(x, y, color, text)
end
local function addButton(y, back, fore, text)
@ -192,8 +192,8 @@ local function printKeyValue(x, y, keyColor, valueColor, key, value, limit)
if totalLength > limit then
value = unicode.sub(value, 1, limit - unicode.len(key .. ": ") - 1) .. ""
end
buffer.text(x, y, keyColor, key .. ":")
buffer.text(x + unicode.len(key) + 2, y, valueColor, value)
buffer.drawText(x, y, keyColor, key .. ":")
buffer.drawText(x + unicode.len(key) + 2, y, valueColor, value)
end
local function getShapeCoords()
@ -210,7 +210,7 @@ local function fixNumber(number)
end
local function drawToolbar()
buffer.square(xToolbar, 1, widthOfToolbar, ySize, colors.toolbarBackground, 0xFFFFFF, " ")
buffer.drawRectangle(xToolbar, 1, widthOfToolbar, ySize, colors.toolbarBackground, 0xFFFFFF, " ")
local x = xToolbar + 8
local y = 3
@ -328,7 +328,7 @@ local function printModel(count)
end
local function drawPixel(x, y, width, height, color, trasparency)
buffer.square(xDrawingZone + x * pixelWidth - pixelWidth, yDrawingZone + y * pixelHeight - pixelHeight, width * pixelWidth, height * pixelHeight, color, 0xFFFFFF, " ", trasparency)
buffer.drawRectangle(xDrawingZone + x * pixelWidth - pixelWidth, yDrawingZone + y * pixelHeight - pixelHeight, width * pixelWidth, height * pixelHeight, color, 0xFFFFFF, " ", trasparency)
end
local function setka()
@ -396,10 +396,10 @@ local function drawDrawingZone()
end
local function drawAll()
buffer.square(1, 2, xSize, ySize, colors.drawingZoneCYKA, 0xFFFFFF, " ")
buffer.drawRectangle(1, 2, xSize, ySize, colors.drawingZoneCYKA, 0xFFFFFF, " ")
drawDrawingZone()
drawToolbar()
buffer.draw()
buffer.drawChanges()
drawTopMenu(0)
end
@ -457,11 +457,11 @@ while true do
startPointSelected = true
model.shapes[currentShape] = nil
-- buffer.square(xDrawingZone, yDrawingZone, drawingZoneWidth, drawingZoneHeight, colors.drawingZoneBackground, 0xFFFFFF, " ")
-- buffer.drawRectangle(xDrawingZone, yDrawingZone, drawingZoneWidth, drawingZoneHeight, colors.drawingZoneBackground, 0xFFFFFF, " ")
drawPixel(xShapeStart, yShapeStart, 1, 1, colors.drawingZoneStartPoint)
buffer.draw()
buffer.drawChanges()
else
xShapeEnd = math.ceil((e[3] - xDrawingZone + 1) / pixelWidth)
yShapeEnd = math.ceil((e[4] - yDrawingZone + 1) / pixelHeight)
@ -506,7 +506,7 @@ while true do
for key in pairs(obj.ToolbarButtons) do
if ecs.clickedAtArea(e[3], e[4], obj.ToolbarButtons[key][1], obj.ToolbarButtons[key][2], obj.ToolbarButtons[key][3], obj.ToolbarButtons[key][4]) then
buffer.button(obj.ToolbarButtons[key][1], obj.ToolbarButtons[key][2], widthOfToolbar - 4, 3, ecs.colors.blue, 0xFFFFFF, key)
buffer.draw()
buffer.drawChanges()
os.sleep(0.2)
if key == "Напечатать" then
@ -596,7 +596,7 @@ while true do
if ecs.clickedAtArea(e[3], e[4], obj.TopMenu[key][1], obj.TopMenu[key][2], obj.TopMenu[key][3], obj.TopMenu[key][4]) then
drawTopMenu(obj.TopMenu[key][5])
-- buffer.button(obj.TopMenu[key][1] - 1, obj.TopMenu[key][2], unicode.len(key) + 2, 1, ecs.colors.blue, 0xFFFFFF, key)
-- buffer.draw()
-- buffer.drawChanges()
local action
if key == "Файл" then
@ -659,7 +659,7 @@ while true do
elseif action == "Выход" then
gpu.setResolution(xOld, yOld)
buffer.flush()
buffer.draw(true)
buffer.drawChanges(true)
if hologramAvailable then component.hologram.clear() end
return
elseif action == "Масштаб" then

View File

@ -381,14 +381,14 @@ local lines = {
"Timofeef Igor (vk.com/id7799889), Trifonov Gleb (vk.com/id88323331), Verevkin Yakov (vk.com/id60991376), Bogushevich Victoria (vk.com/id171497518)",
"All rights reserved",
}
mainContainer:addChild(GUI.textBox(1, mainContainer.height - #lines + 1, mainContainer.width, #lines, nil, 0x3C3C3C, lines, 1)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer:addChild(GUI.textBox(1, mainContainer.height - #lines + 1, mainContainer.width, #lines, nil, 0x3C3C3C, lines, 1)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
local elementY = 2
mainContainer.toolbar = mainContainer:addChild(GUI.container(mainContainer.width - 31, 1, 32, mainContainer.height))
local elementWidth = mainContainer.toolbar.width - 2
mainContainer.toolbar:addChild(GUI.panel(1, 1, mainContainer.toolbar.width, mainContainer.toolbar.height, 0x0, 0.5))
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "Render mode")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); elementY = elementY + 2
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "Render mode")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); elementY = elementY + 2
mainContainer.toolbar.renderModeComboBox = mainContainer.toolbar:addChild(GUI.comboBox(2, elementY, elementWidth, 1, 0x2D2D2D, 0xAAAAAA, 0x555555, 0x888888)); elementY = elementY + mainContainer.toolbar.renderModeComboBox.height + 1
mainContainer.toolbar.renderModeComboBox:addItem("disabled")
mainContainer.toolbar.renderModeComboBox:addItem("constantShading")
@ -427,7 +427,7 @@ local function calculateLightComboBox()
mainContainer.toolbar.lightEmissionSlider.value = scene.lights[mainContainer.toolbar.lightSelectComboBox.selectedItem].emissionDistance
end
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "Light control")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); elementY = elementY + 2
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "Light control")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); elementY = elementY + 2
mainContainer.toolbar.lightSelectComboBox = mainContainer.toolbar:addChild(GUI.comboBox(2, elementY, elementWidth, 1, 0x2D2D2D, 0xAAAAAA, 0x555555, 0x888888)); elementY = elementY + mainContainer.toolbar.lightSelectComboBox.height + 1
mainContainer.toolbar.addLightButton = mainContainer.toolbar:addChild(GUI.button(2, elementY, elementWidth, 1, 0x2D2D2D, 0xAAAAAA, 0x555555, 0xAAAAAA, "Add light")); elementY = elementY + 2
@ -460,7 +460,7 @@ mainContainer.toolbar.backgroundColorSelector.onTouch = function()
scene.backgroundColor = mainContainer.toolbar.backgroundColorSelector.color
end
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "RAM monitoring")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); elementY = elementY + 2
mainContainer.toolbar:addChild(GUI.label(2, elementY, elementWidth, 1, 0xEEEEEE, "RAM monitoring")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); elementY = elementY + 2
mainContainer.toolbar.RAMChart = mainContainer.toolbar:addChild(GUI.chart(2, elementY, elementWidth, mainContainer.toolbar.height - elementY - 3, 0xEEEEEE, 0xAAAAAA, 0x555555, 0x66DB80, 0.35, 0.25, "s", "%", true, {})); elementY = elementY + mainContainer.toolbar.RAMChart.height + 1
mainContainer.toolbar.RAMChart.roundValues = true
-- mainContainer.toolbar.RAMChart.showXAxisValues = false

View File

@ -87,7 +87,7 @@ local config, fileVersions, user
--------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.tabbedWindow(1, 1, 110, 29))
local mainContainer, window = MineOSInterface.addWindow(GUI.tabbedWindow(1, 1, 110, 29))
local contentContainer = window:addChild(GUI.container(1, 4, 1, 1))
@ -97,17 +97,17 @@ activityWidget.position = 0
activityWidget.color1 = 0x99FF80
activityWidget.color2 = 0x00B640
activityWidget.draw = function(activityWidget)
buffer.text(activityWidget.x + 1, activityWidget.y, activityWidget.position == 1 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 2, activityWidget.y, activityWidget.position == 1 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 1, activityWidget.y, activityWidget.position == 1 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 2, activityWidget.y, activityWidget.position == 1 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 3, activityWidget.y + 1, activityWidget.position == 2 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 2, activityWidget.y + 1, activityWidget.position == 2 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 3, activityWidget.y + 1, activityWidget.position == 2 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 2, activityWidget.y + 1, activityWidget.position == 2 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 1, activityWidget.y + 2, activityWidget.position == 3 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 2, activityWidget.y + 2, activityWidget.position == 3 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 1, activityWidget.y + 2, activityWidget.position == 3 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 2, activityWidget.y + 2, activityWidget.position == 3 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x, activityWidget.y + 1, activityWidget.position == 4 and activityWidget.color1 or activityWidget.color2, "")
buffer.text(activityWidget.x + 1, activityWidget.y + 1, activityWidget.position == 4 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x, activityWidget.y + 1, activityWidget.position == 4 and activityWidget.color1 or activityWidget.color2, "")
buffer.drawText(activityWidget.x + 1, activityWidget.y + 1, activityWidget.position == 4 and activityWidget.color1 or activityWidget.color2, "")
end
local overrideWindowDraw = window.draw
@ -203,10 +203,10 @@ local function fieldAPIRequest(fieldToReturn, script, data)
if success[fieldToReturn] then
return success[fieldToReturn]
else
GUI.error("Request was successful, but field " .. tostring(fieldToReturn) .. " doesn't exists")
GUI.alert("Request was successful, but field " .. tostring(fieldToReturn) .. " doesn't exists")
end
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -281,7 +281,7 @@ end
local function tryToDownload(...)
local success, reason = web.download(...)
if not success then
GUI.error(reason)
GUI.alert(reason)
end
return success
@ -295,14 +295,14 @@ local function callLastMethod()
end
local function showLabelAsContent(container, text)
container:deleteChildren()
container:addChild(GUI.label(1, 1, container.width, container.height, 0x2D2D2D, text)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.center)
container:removeChildren()
container:addChild(GUI.label(1, 1, container.width, container.height, 0x2D2D2D, text)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
end
local function newButtonsLayout(x, y, width, spacing)
local buttonsLayout = GUI.layout(x, y, width, 1, 1, 1)
buttonsLayout:setCellDirection(1, 1, GUI.directions.horizontal)
buttonsLayout:setCellSpacing(1, 1, spacing)
buttonsLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
buttonsLayout:setSpacing(1, 1, spacing)
return buttonsLayout
end
@ -326,7 +326,7 @@ end
local function ratingWidgetDraw(object)
local x = 0
for i = 1, 5 do
buffer.text(object.x + x, object.y, object.rating >= i and object.colors.first or object.colors.second, "*")
buffer.drawText(object.x + x, object.y, object.rating >= i and object.colors.first or object.colors.second, "*")
x = x + object.spacing
end
@ -358,15 +358,15 @@ local function deletePublication(publication)
})
if success then
container:delete()
container:remove()
updateFileList(publication.category_id)
else
GUI.error(reason)
GUI.alert(reason)
end
end
buttonsLayout:addChild(GUI.adaptiveRoundedButton(1, 1, 2, 0, 0xA5A5A5, 0x2D2D2D, 0x0, 0xE1E1E1, localization.no)).onTouch = function()
container:delete()
container:remove()
MineOSInterface.mainContainer:drawOnScreen()
end
end
@ -408,7 +408,7 @@ local function download(publication)
if publication then
local container = MineOSInterface.addUniversalContainer(MineOSInterface.mainContainer, localization.choosePath)
container.layout:setCellFitting(2, 1, false, false)
container.layout:setFitting(2, 1, false, false)
local filesystemChooserPath = fileVersions[publication.file_id] and getApplicationPathFromVersions(fileVersions[publication.file_id].path)
if not filesystemChooserPath then
@ -420,7 +420,7 @@ local function download(publication)
end
local filesystemChooser = container.layout:addChild(GUI.filesystemChooser(1, 1, 44, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696, filesystemChooserPath, localization.save, localization.cancel, localization.fileName, "/"))
filesystemChooser:setMode(GUI.filesystemModes.save, GUI.filesystemModes.file)
filesystemChooser:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
container.layout:addChild(GUI.text(1, 1, 0xE1E1E1, localization.tree))
local tree = container.layout:addChild(GUI.tree(1, 1, 44, 10, 0xE1E1E1, 0xA5A5A5, 0x3C3C3C, 0xA5A5A5, 0x3C3C3C, 0xE1E1E1, 0xB4B4B4, 0xA5A5A5, 0xC3C3C3, 0x444444))
@ -485,7 +485,7 @@ local function download(publication)
shortcutSwitchAndLabel.hidden = publication.category_id == 2
container.layout:addChild(GUI.button(1, 1, 44, 3, 0x696969, 0xFFFFFF, 0x0, 0xFFFFFF, localization.download)).onTouch = function()
container.layout:deleteChildren(2)
container.layout:removeChildren(2)
local progressBar = container.layout:addChild(GUI.progressBar(1, 1, 40, 0x66DB80, 0x0, 0xE1E1E1, 0, true, true, "", "%"))
local countOfShit = 1 + (publication.all_dependencies and #publication.all_dependencies or 0)
@ -524,7 +524,7 @@ local function download(publication)
end
end
container:delete()
container:remove()
callLastMethod()
if not shortcutSwitchAndLabel.hidden and shortcutSwitchAndLabel.switch.state then
@ -666,7 +666,7 @@ mainMenu = function(menuID, messageToUser)
window.tabBar:select(1)
lastMethod, lastArguments = mainMenu, {menuID, messageToUser}
contentContainer:deleteChildren()
contentContainer:removeChildren()
local menuList = contentContainer:addChild(GUI.list(1, 1, 23, contentContainer.height, 3, 0, 0xE1E1E1, 0x4B4B4B, 0xD2D2D2, 0x4B4B4B, 0x4B4B4B, 0xE1E1E1))
local menuContentContainer = contentContainer:addChild(GUI.container(menuList.width + 1, 1, contentContainer.width - menuList.width, contentContainer.height))
@ -687,7 +687,7 @@ mainMenu = function(menuID, messageToUser)
})
if publications then
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local iconsContainer = menuContentContainer:addChild(GUI.container(1, 1, menuContentContainer.width, menuContentContainer.height))
@ -700,7 +700,7 @@ mainMenu = function(menuID, messageToUser)
statisticsLayout:addChild(GUI.image(1, 1, image.load(currentScriptDirectory .. "Icon.pic"))).height = 5
local textLayout = statisticsLayout:addChild(GUI.layout(1, 1, container.width - 4, 1, 1, 1))
textLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
textLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
textLayout:addChild(GUI.keyAndValue(1, 1, 0x4B4B4B, 0xA5A5A5, localization.statisticsUsersCount, ": " .. statistics.users_count))
textLayout:addChild(GUI.keyAndValue(1, 1, 0x4B4B4B, 0xA5A5A5, localization.statisticsNewUser, ": " .. statistics.last_registered_user))
@ -711,7 +711,7 @@ mainMenu = function(menuID, messageToUser)
local applicationPreview = statisticsLayout:addChild(newApplicationPreview(1, 1, publications[1]))
applicationPreview.panel.colors.background = 0xF0F0F0
statisticsLayout:addChild(GUI.label(1, 1, statisticsLayout.width, 1, 0xA5A5A5, localization.statisticsPopularPublication)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.center)
statisticsLayout:addChild(GUI.label(1, 1, statisticsLayout.width, 1, 0xA5A5A5, localization.statisticsPopularPublication)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
MineOSInterface.mainContainer:drawOnScreen()
@ -834,7 +834,7 @@ mainMenu = function(menuID, messageToUser)
end
messages = messages or {}
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local button = menuContentContainer:addChild(GUI.adaptiveButton(1, menuContentContainer.height - 2, 2, 1, 0x4B4B4B, 0xE1E1E1, 0x2D2D2D, 0xE1E1E1, localization.send))
button.localX = menuContentContainer.width - button.width + 1
@ -862,7 +862,7 @@ mainMenu = function(menuID, messageToUser)
if success then
dialogGUI(to_user_name)
else
GUI.error(reason)
GUI.alert(reason)
end
activity(false)
@ -883,27 +883,27 @@ mainMenu = function(menuID, messageToUser)
else
local keyAndValue = menuContentContainer:addChild(GUI.keyAndValue(1, 2, 0x878787, 0x0, localization.dialogWith, to_user_name))
keyAndValue.localX = math.floor(menuContentContainer.width / 2 - (keyAndValue.keyLength + keyAndValue.valueLength) / 2)
-- menuContentContainer:addChild(GUI.label(1, 2, menuContentContainer.width, 1, 0x2D2D2D, to_user_name)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.center)
-- menuContentContainer:addChild(GUI.label(1, 2, menuContentContainer.width, 1, 0x2D2D2D, to_user_name)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
end
local function cloudDraw(object)
local backgroundColor, textColor = object.me and 0x6692FF or 0xFFFFFF, object.me and 0xFFFFFF or 0x4B4B4B
buffer.square(object.x, object.y, object.width, object.height, backgroundColor, textColor, " ")
buffer.text(object.x, object.y - 1, backgroundColor, "" .. string.rep("", object.width - 2) .. "")
buffer.text(object.x, object.y + object.height, backgroundColor, "" .. string.rep("", object.width - 2) .. "")
buffer.drawRectangle(object.x, object.y, object.width, object.height, backgroundColor, textColor, " ")
buffer.drawText(object.x, object.y - 1, backgroundColor, "" .. string.rep("", object.width - 2) .. "")
buffer.drawText(object.x, object.y + object.height, backgroundColor, "" .. string.rep("", object.width - 2) .. "")
local date = os.date("%d.%m.%Y, %H:%M", object.timestamp)
if object.me then
buffer.text(object.x - #date - 1, object.y, 0xC3C3C3, date)
buffer.text(object.x + object.width, object.y + object.height - 1, backgroundColor, "")
buffer.drawText(object.x - #date - 1, object.y, 0xC3C3C3, date)
buffer.drawText(object.x + object.width, object.y + object.height - 1, backgroundColor, "")
else
buffer.text(object.x + object.width + 1, object.y, 0xC3C3C3, date)
buffer.text(object.x - 1, object.y + object.height - 1, backgroundColor, "")
buffer.drawText(object.x + object.width + 1, object.y, 0xC3C3C3, date)
buffer.drawText(object.x - 1, object.y + object.height - 1, backgroundColor, "")
end
for i = 1, #object.lines do
buffer.text(object.x + 1, object.y + i - 1, textColor, object.lines[i])
buffer.drawText(object.x + 1, object.y + i - 1, textColor, object.lines[i])
end
end
@ -939,7 +939,7 @@ mainMenu = function(menuID, messageToUser)
})
if dialogs then
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local dialogsContainer = menuContentContainer:addChild(GUI.container(1, 1, menuContentContainer.width, menuContentContainer.height))
dialogsContainer.eventHandler = containerScrollEventHandler
@ -975,7 +975,7 @@ mainMenu = function(menuID, messageToUser)
y = y + dialogContainer.height + 1
end
else
dialogsContainer:addChild(GUI.label(1, sendMessageButton.localY - 2, dialogsContainer.width, 1, 0xA5A5A5, localization.hereBeYourDialogs)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.center)
dialogsContainer:addChild(GUI.label(1, sendMessageButton.localY - 2, dialogsContainer.width, 1, 0xA5A5A5, localization.hereBeYourDialogs)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_CENTER)
end
end
@ -983,7 +983,7 @@ mainMenu = function(menuID, messageToUser)
end
local function settings()
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local layout = menuContentContainer:addChild(GUI.layout(1, 1, menuContentContainer.width, menuContentContainer.height, 1, 1))
layout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.language))
@ -1017,10 +1017,10 @@ mainMenu = function(menuID, messageToUser)
end
local function addAccountShit(login, register, recover)
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local layout = menuContentContainer:addChild(GUI.layout(1, 1, menuContentContainer.width, menuContentContainer.height, 1, 1))
layout:addChild(GUI.label(1, 1, 36, 1, 0x0, login and localization.login or register and localization.createAccount or recover and localization.changePassword)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
layout:addChild(GUI.label(1, 1, 36, 1, 0x0, login and localization.login or register and localization.createAccount or recover and localization.changePassword)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
local nameInput = layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", localization.nickname))
local emailInput = layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", login and localization.nicknameOrEmail or "E-mail"))
local currentPasswordInput = layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", localization.currentPassword, false, "*"))
@ -1074,7 +1074,7 @@ mainMenu = function(menuID, messageToUser)
if success then
logout()
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -1083,7 +1083,7 @@ mainMenu = function(menuID, messageToUser)
if login then
local registerLayout = layout:addChild(GUI.layout(1, 1, layout.width, 1, 1, 1))
registerLayout:setCellDirection(1, 1, GUI.directions.horizontal)
registerLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
registerLayout:addChild(GUI.text(1, 1, 0xA5A5A5, localization.notRegistered))
registerLayout:addChild(GUI.adaptiveButton(1, 1, 0, 0, nil, 0x696969, nil, 0x0, localization.createAccount)).onTouch = function()
addAccountShit(false, true, false)
@ -1106,13 +1106,13 @@ mainMenu = function(menuID, messageToUser)
})
if result then
menuContentContainer:deleteChildren()
menuContentContainer:removeChildren()
local layout = menuContentContainer:addChild(GUI.layout(1, 1, menuContentContainer.width, menuContentContainer.height, 1, 1))
layout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.profile))
local textLayout = layout:addChild(GUI.layout(1, 1, 36, 5, 1, 1))
textLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
textLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
textLayout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0x969696, localization.nickname, ": " .. user.name))
textLayout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0x969696, "E-Mail", ": " .. user.email))
@ -1222,14 +1222,14 @@ newPublicationInfo = function(file_id)
})
if reviews then
contentContainer:deleteChildren()
contentContainer:removeChildren()
local infoContainer = contentContainer:addChild(GUI.container(1, 1, contentContainer.width, contentContainer.height))
infoContainer.eventHandler = containerScrollEventHandler
-- Жирный йоба-лейаут для отображения ВАЩЕ всего - и инфы, и отзыввов
local layout = infoContainer:addChild(GUI.layout(3, 2, infoContainer.width - 4, infoContainer.height, 1, 1))
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
-- А вот эт уже контейнер чисто инфы крч
local detailsContainer = layout:addChild(GUI.container(3, 2, layout.width, 6))
@ -1299,7 +1299,7 @@ newPublicationInfo = function(file_id)
buttonsLayout:addChild(GUI.adaptiveRoundedButton(1, 1, 1, 0, 0xA5A5A5, 0xFFFFFF, 0x2D2D2D, 0xFFFFFF, existingReviewText and localization.changeReview or localization.writeReview)).onTouch = function()
local container = MineOSInterface.addUniversalContainer(window, existingReviewText and localization.changeReview or localization.writeReview)
container.layout:setCellFitting(2, 1, false, false)
container.layout:setFitting(2, 1, false, false)
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, existingReviewText or "", localization.writeReviewHere))
@ -1329,13 +1329,13 @@ newPublicationInfo = function(file_id)
comment = input.text,
})
container:delete()
container:remove()
MineOSInterface.mainContainer:drawOnScreen()
if success then
newPublicationInfo(publication.file_id)
else
GUI.error(reason)
GUI.alert(reason)
end
activity()
@ -1348,7 +1348,7 @@ newPublicationInfo = function(file_id)
else
govno.disabled = true
if textLength > to then
GUI.error("Too big review length (" .. textLength .. "). Maximum is " .. to)
GUI.alert("Too big review length (" .. textLength .. "). Maximum is " .. to)
end
end
@ -1382,7 +1382,7 @@ newPublicationInfo = function(file_id)
end
if publicationDependencyExists then
textDetailsContainer:addChild(GUI.label(1, y, textDetailsContainer.width, 1, 0x696969, localization.dependencies)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
textDetailsContainer:addChild(GUI.label(1, y, textDetailsContainer.width, 1, 0x696969, localization.dependencies)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + 2
for i = 1, #publication.all_dependencies do
@ -1449,8 +1449,8 @@ newPublicationInfo = function(file_id)
local wasHelpText = reviewContainer:addChild(GUI.text(3, y, 0xC3C3C3, localization.wasReviewHelpful))
local layout = reviewContainer:addChild(GUI.layout(wasHelpText.localX + wasHelpText.width + 1, y, reviewContainer.width - wasHelpText.localX - wasHelpText.width - 1, 1, 1, 1))
layout:setCellDirection(1, 1, GUI.directions.horizontal)
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
local function go(rating)
activity(true)
@ -1464,7 +1464,7 @@ newPublicationInfo = function(file_id)
if success then
wasHelpText.text = localization.thanksForVote
wasHelpText.color = 0x696969
layout:delete()
layout:remove()
end
activity()
@ -1502,14 +1502,14 @@ end
local function newPlusMinusCyka(width, disableLimit)
local layout = GUI.layout(1, 1, width, 1, 2, 1)
layout:setColumnWidth(1, GUI.sizePolicies.percentage, 1.0)
layout:setColumnWidth(2, GUI.sizePolicies.absolute, 8)
layout:setCellFitting(1, 1, true, false)
layout:setCellMargin(2, 1, 1, 0)
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
layout:setCellAlignment(2, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
layout:setCellDirection(1, 1, GUI.directions.horizontal)
layout:setCellDirection(2, 1, GUI.directions.horizontal)
layout:setColumnWidth(1, GUI.SIZE_POLICY_RELATIVE, 1.0)
layout:setColumnWidth(2, GUI.SIZE_POLICY_ABSOLUTE, 8)
layout:setFitting(1, 1, true, false)
layout:setMargin(2, 1, 1, 0)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
layout:setAlignment(2, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
layout:setDirection(2, 1, GUI.DIRECTION_HORIZONTAL)
layout.comboBox = layout:addChild(GUI.comboBox(1, 1, width - 7, 1, 0xFFFFFF, 0x696969, 0x969696, 0xE1E1E1))
layout.defaultColumn = 2
@ -1532,16 +1532,16 @@ end
editPublication = function(initialPublication, initialCategoryID)
lastMethod, lastArguments = editPublication, {initialPublication}
contentContainer:deleteChildren()
contentContainer:removeChildren()
local layout = contentContainer:addChild(GUI.layout(1, 1, contentContainer.width, contentContainer.height, 3, 1))
layout:setColumnWidth(1, GUI.sizePolicies.percentage, 0.5)
layout:setColumnWidth(2, GUI.sizePolicies.absolute, 36)
layout:setColumnWidth(3, GUI.sizePolicies.percentage, 0.5)
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.right, GUI.alignment.vertical.center)
layout:setCellAlignment(2, 1, GUI.alignment.horizontal.left, GUI.alignment.vertical.center)
layout:setCellFitting(2, 1, true, false)
layout:setCellMargin(1, 1, 1, 0)
layout:setColumnWidth(1, GUI.SIZE_POLICY_RELATIVE, 0.5)
layout:setColumnWidth(2, GUI.SIZE_POLICY_ABSOLUTE, 36)
layout:setColumnWidth(3, GUI.SIZE_POLICY_RELATIVE, 0.5)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_RIGHT, GUI.ALIGNMENT_VERTICAL_CENTER)
layout:setAlignment(2, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_CENTER)
layout:setFitting(2, 1, true, false)
layout:setMargin(1, 1, 1, 0)
layout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.category .. ":"))
layout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.license .. ":"))
@ -1554,7 +1554,7 @@ editPublication = function(initialPublication, initialCategoryID)
layout.defaultColumn = 2
layout:addChild(GUI.label(1, 1, 36, 1, 0x0, initialPublication and localization.edit or localization.publish)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
layout:addChild(GUI.label(1, 1, 36, 1, 0x0, initialPublication and localization.edit or localization.publish)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
local categoryComboBox = layout:addChild(GUI.comboBox(1, 1, 36, 1, 0xFFFFFF, 0x696969, 0x969696, 0xE1E1E1))
for i = 1, #categories do
@ -1610,7 +1610,7 @@ editPublication = function(initialPublication, initialCategoryID)
dependenciesLayout.addButton.onTouch = function()
local container = MineOSInterface.addUniversalContainer(MineOSInterface.mainContainer, localization.addDependency)
container.layout:setCellFitting(2, 1, false, false)
container.layout:setFitting(2, 1, false, false)
local dependencyTypeComboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0x969696, 0xE1E1E1))
dependencyTypeComboBox:addItem(localization.fileByURL)
@ -1630,7 +1630,7 @@ editPublication = function(initialPublication, initialCategoryID)
source_url = lastDependencyType == 1 and urlInput.text or nil,
})
container:delete()
container:remove()
MineOSInterface.mainContainer:drawOnScreen()
end
@ -1727,7 +1727,7 @@ editPublication = function(initialPublication, initialCategoryID)
updateFileList(categoryComboBox.selectedItem)
end
else
GUI.error(reason)
GUI.alert(reason)
end
activity()
@ -1761,7 +1761,7 @@ updateFileList = function(category_id, updates)
})
if result then
contentContainer:deleteChildren()
contentContainer:removeChildren()
if updates then
local i = 1
@ -1776,15 +1776,15 @@ updateFileList = function(category_id, updates)
local y = 2
local layout = contentContainer:addChild(GUI.layout(1, y, contentContainer.width, 1, 1, 1))
layout:setCellDirection(1, 1, GUI.directions.horizontal)
layout:setCellSpacing(1, 1, 2)
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
layout:setSpacing(1, 1, 2)
if not updates or updates and #result > 0 then
if updates then
if #result > 0 then
layout:addChild(GUI.adaptiveRoundedButton(1, 1, 2, 0, 0x696969, 0xFFFFFF, 0x2D2D2D, 0xFFFFFF, localization.updateAll)).onTouch = function()
local container = MineOSInterface.addUniversalContainer(MineOSInterface.mainContainer, "")
container.layout:setCellFitting(2, 1, false, false)
container.layout:setFitting(2, 1, false, false)
local progressBar = container.layout:addChild(GUI.progressBar(1, 1, 40, 0x66DB80, 0x0, 0xE1E1E1, 0, true, true, "", "%"))
@ -1827,7 +1827,7 @@ updateFileList = function(category_id, updates)
end
end
container:delete()
container:remove()
saveFileVersions()
computer.shutdown(true)
end
@ -1876,8 +1876,8 @@ updateFileList = function(category_id, updates)
y = y + layout.height + 1
local navigationLayout = contentContainer:addChild(GUI.layout(1, contentContainer.height - 1, contentContainer.width, 1, 1, 1))
navigationLayout:setCellDirection(1, 1, GUI.directions.horizontal)
navigationLayout:setCellSpacing(1, 1, 2)
navigationLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
navigationLayout:setSpacing(1, 1, 2)
local function switchPage(forward)
currentPage = currentPage + (forward and 1 or -1)
@ -1959,7 +1959,7 @@ window.onResize = function(width, height)
appsPerPage = appsPerWidth * appsPerHeight
currentPage = 0
contentContainer:deleteChildren()
contentContainer:removeChildren()
callLastMethod()
end

View File

@ -10,10 +10,10 @@ local MineOSInterface = require("MineOSInterface")
---------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 32, 19, 0x2D2D2D))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 32, 19, 0x2D2D2D))
local layout = window:addChild(GUI.layout(1, 2, 1, 1, 1, 1))
layout:setCellDirection(1, 1, GUI.directions.horizontal)
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
local newButton = layout:addChild(GUI.button(1, 1, 3, 1, 0x444444, 0xE1E1E1, 0xE1E1E1, 0x444444, "N"))
local saveButton = layout:addChild(GUI.button(1, 1, 3, 1, 0x444444, 0xE1E1E1, 0xE1E1E1, 0x444444, "S"))
@ -37,9 +37,9 @@ local function newCell(x, y, shaded)
for y = 1, 4 do
for x = 1, 2 do
if object.pixels[y][x] then
buffer.square(object.x + x * 2 - 2, object.y + y - 1, 2, 1, object.pixels[y][x] == 1 and object.foreground or object.background, 0x0, " ")
buffer.drawRectangle(object.x + x * 2 - 2, object.y + y - 1, 2, 1, object.pixels[y][x] == 1 and object.foreground or object.background, 0x0, " ")
else
buffer.square(object.x + x * 2 - 2, object.y + y - 1, 2, 1, 0xFFFFFF, object.shaded and (step and 0xC3C3C3 or 0xB4B4B4) or (step and 0xE1E1E1 or 0xD2D2D2), "")
buffer.drawRectangle(object.x + x * 2 - 2, object.y + y - 1, 2, 1, 0xFFFFFF, object.shaded and (step and 0xC3C3C3 or 0xB4B4B4) or (step and 0xE1E1E1 or 0xD2D2D2), "")
end
step = not step
end
@ -77,7 +77,7 @@ end
local drawingArea = window:addChild(GUI.container(1, 4, 1, 1))
local overrideDraw = drawingArea.draw
drawingArea.draw = function(...)
GUI.windowShadow(drawingArea.x, drawingArea.y, drawingArea.width, drawingArea.height, GUI.colors.contextMenu.transparency.shadow, true)
GUI.drawShadow(drawingArea.x, drawingArea.y, drawingArea.width, drawingArea.height, GUI.colors.contextMenu.transparency.shadow, true)
overrideDraw(...)
end
@ -99,7 +99,7 @@ local function newNoGUI(width, height)
layout.width = window.backgroundPanel.width
drawingArea:deleteChildren()
drawingArea:removeChildren()
local x, y, step = 1, 1, false
for j = 1, height do
@ -126,7 +126,7 @@ local function new()
container.panel.eventHandler = function(mainContainer, object, e1)
if e1 == "touch" then
container:delete()
container:remove()
newNoGUI(tonumber(widthTextBox.text), tonumber(heightTextBox.text))
@ -163,9 +163,9 @@ newButton.onTouch = function()
end
saveButton.onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "OK", "Cancel", "Path", "/")
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "OK", "Cancel", "Path", "/")
filesystemDialog:setMode(GUI.filesystemModes.save, GUI.filesystemModes.file)
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
filesystemDialog:addExtensionFilter(".pic")
filesystemDialog:addExtensionFilter(".braiile")
@ -180,7 +180,7 @@ saveButton.onTouch = function()
local brailleArray, transparencyCyka, backgroundCyka, foregroundCyka = fillBrailleArray(drawingArea.children[childIndex].pixels)
if transparencyCyka then
if backgroundCyka and foregroundCyka then
GUI.error("Пиксель " .. x .. "x" .. y .. " имеет два цвета и прозрачность. Убирай любой из цветов и наслаждайся")
GUI.alert("Пиксель " .. x .. "x" .. y .. " имеет два цвета и прозрачность. Убирай любой из цветов и наслаждайся")
return
else
background = 0x0
@ -226,14 +226,14 @@ saveButton.onTouch = function()
end
openButton.onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "OK", "Cancel", "Path", "/")
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "OK", "Cancel", "Path", "/")
filesystemDialog:setMode(GUI.filesystemModes.open, GUI.filesystemModes.file)
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
filesystemDialog:addExtensionFilter(".braiile")
filesystemDialog.onSubmit = function(path)
local pizda = table.fromFile(path)
drawingArea:deleteChildren()
drawingArea:removeChildren()
newNoGUI(pizda.width, pizda.height)
@ -249,8 +249,8 @@ openButton.onTouch = function()
filesystemDialog:show()
end
window.actionButtons.minimize:delete()
window.actionButtons.maximize:delete()
window.actionButtons.minimize:remove()
window.actionButtons.maximize:remove()
---------------------------------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@ local image = require("image")
local fs = require("filesystem")
if not component.isAvailable("camera") then
GUI.error("This program reqiures camera from computronix mod")
GUI.alert("This program reqiures camera from computronix mod")
return
end
@ -58,17 +58,17 @@ local thermal = {
}
local palette = grayscale
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 100, 25, 0x2D2D2D))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 100, 25, 0x2D2D2D))
window.backgroundPanel.width = 22
window.backgroundPanel.height = window.height
window.backgroundPanel.colors.transparency = nil
local layout = window:addChild(GUI.layout(1, 4, window.backgroundPanel.width, window.backgroundPanel.height - 3, 1, 1))
layout:setCellFitting(1, 1, true, false, 2, 0)
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
layout:setFitting(1, 1, true, false, 2, 0)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
layout:addChild(GUI.label(1, 1, 1, 1, 0xC3C3C3, "Select camera"):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
layout:addChild(GUI.label(1, 1, 1, 1, 0xC3C3C3, "Select camera"):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local comboBox = layout:addChild(GUI.comboBox(1, 1, 36, 1, 0xF0F0F0, 0x2D2D2D, 0x444444, 0x999999))
local paletteSwitch = layout:addChild(GUI.switchAndLabel(1, 1, 16, 6, 0x66DB80, 0x0, 0xF0F0F0, 0xC3C3C3, "Thermal:", false)).switch
local semiPixelSwitch = layout:addChild(GUI.switchAndLabel(1, 1, 16, 6, 0x66DB80, 0x0, 0xF0F0F0, 0xC3C3C3, "Semipixels:", true)).switch
@ -108,7 +108,7 @@ local buttonImage = image.load(fs.path(getCurrentScript()) .. "Icon.pic")
local buttonImagePressed = image.blend(buttonImage, 0x0, 0.6)
local shootButton = window:addChild(GUI.object(1, 1, 8, 4))
shootButton.draw = function()
buffer.image(shootButton.x, shootButton.y, shootButton.pressed and buttonImagePressed or buttonImage)
buffer.drawImage(shootButton.x, shootButton.y, shootButton.pressed and buttonImagePressed or buttonImage)
end
shootButton.eventHandler = function(mainContainer, object, e1)
@ -124,7 +124,7 @@ shootButton.eventHandler = function(mainContainer, object, e1)
end
cameraView.draw = function(cameraView)
buffer.square(cameraView.x, cameraView.y, cameraView.width, cameraView.height, 0xF0F0F0, 0x878787, " ")
buffer.drawRectangle(cameraView.x, cameraView.y, cameraView.width, cameraView.height, 0xF0F0F0, 0x878787, " ")
local x, y = 0, 0
for y = 1, #cameraView.pixels do
for x = 1, #cameraView.pixels[y] do

View File

@ -1,251 +0,0 @@
----------------------------------------------------------------------------------------------------------------------------------
local components = require("component")
local event = require("event")
local unicode = require("unicode")
local sides = require("sides")
local sha = require("SHA2")
local ecs = require("ECSAPI")
local commandBlock = components.command_block
local gpu = components.gpu
local chat = components.chat_box
local redstone = component.redstone
local administrators = {"IT", "Pornogion"}
local votes = {
mute = {
},
}
local voteTime = 5
local votesToDoSomething = 1
----------------------------------------------------------------------------------------------------------------------------------
local function execute(command)
commandBlock.setCommand(command)
commandBlock.executeCommand()
end
local function tellraw(toPlayer, text)
execute("/tellraw " .. toPlayer .. " [\"\",{\"text\":\" Сервер\",\"color\":\"gold\"},{\"text\":\": " .. text .. "\",\"color\":\"none\"}]")
end
local function parseEventData(eventData)
local nickname = eventData[3]
local words = {}
for word in string.gmatch(eventData[4], "[^%s]*") do
if word ~= " " and word ~= "" then
table.insert(words, word)
end
end
return nickname, words
end
local function getCount(massiv)
local count = 0
for key in pairs(massiv) do
count = count + 1
end
return count
end
local function analyzeMutes()
for nameToMute in pairs(votes.mute) do
if getCount(votes.mute[nameToMute]) >= votesToDoSomething then
tellraw("@a","По решению большинства игроку " .. nameToMute .. " дан мут.")
execute("/mute " .. nameToMute)
votes.mute[nameToMute] = nil
else
tellraw("@a", "Голосование за кик игрока " .. nameToMute .. " отменяется, недостаточно голосов.")
votes.mute[nameToMute] = nil
end
end
end
local function synonym(baseWord, ...)
local synonyms = {...}
for i = 1, #synonyms do
if baseWord == synonyms[i] then return true end
end
return false
end
local function checkNicknameForAdminRights(nickname)
local success = false
for i = 1, #administrators do
if nickname == administrators[i] then success = true; break end
end
if not success then
tellraw("@a[name=" .. nickname .. "]", "Только админстраторы сервера имеют доступ к данной команде.")
end
return success
end
----------------------------------------------------------------------------------------------------------------------------------
ecs.setScale(0.8)
ecs.prepareToExit()
tellraw("@a","Система поддержки чата инициализирована.")
print(" "); print(" Ожидаю команд игроков..."); print(" ")
while true do
local eventData = {event.pull()}
if eventData[1] == "chat_message" then
local nickname, words = parseEventData(eventData)
print(eventData[3] .. ": " .. eventData[4])
-- print("Команды: " .. table.concat(words, ","))
if words[1] == "сервер" or words[1] == "Сервер" or words[1] == "серв" or words[1] == "Серв" then
if words[2] == "замуть" then
votes.mute[words[3]] = votes.mute[words[3]] or {}
votes.mute[words[3]][nickname] = true
event.timer(voteTime, analyzeMutes)
tellraw("@a","Начинается голосование за мут игрока " .. words[3] .. ", количество голосов: " .. getCount(votes.mute[words[3]]) .. " из " .. votesToDoSomething .. ".")
elseif words[2] == "телепортни" or words[2] == "тпни" or words[2] == "тп" or words[2] == "телепортируй" then
if words[3] == "на" and words[4] == "спавн" then
execute("/spawn " .. nickname)
else
tellraw("@a[name=" .. nickname .. "]", "Неизвестная локация для телепортации.")
end
elseif words[2] == "вылечи" or words[2] == "похиль" or words[2] == "хильни" then
execute("/heal " .. nickname)
tellraw("@a[name=" .. nickname .. "]", "Держи хилку!")
elseif (words[2] == "накорми") or (words[2] == "дай" and (words[3] == "пожрать" or words[3] == "похавать")) then
execute("/feed " .. nickname)
tellraw("@a[name=" .. nickname .. "]", "Держи хавку!")
elseif words[2] == "дай" then
if words[3] == "ресов" then
tellraw("@a[name=" .. nickname .. "]", "Ну на.")
execute("/give @a[name=" .. nickname .. "] minecraft:dirt " .. math.random(1, 100))
else
tellraw("@a[name=" .. nickname .. "]", "Чего тебе дать?")
end
elseif words[2] == "как" and words[3] == "дела" then
local dela = {
"Лови молнию в ебло, заебал с допросами.",
"Хуево пиздец. Сейчас такую катку всрал - играл за Инвокера, вышел с мида со счетом 7 0, а в итоге всосали гейм за 20 минут.",
"Ну, более-менее. Даже несмотря на то, что какие-то пидоры все время отвлекают от мирного афк в чате.",
"Нормально. Сам как?",
"Дела заебок, сегодня вытащил матч за войда с тремя ДЦП в тиме. А у тебя как успехи?",
"Отлично! Накодил вон потный скрипт, сейчас буду тестировать. error[320] in cyka.lua: attempt to index countOfFatMothers (a nil value) Бля.",
"Старая шлюха родила! Иди на хуй со своими расспросами.",
}
local number = math.random(1, #dela)
if number == 1 then execute("/shock " .. nickname) end
tellraw("@a", dela[number])
elseif words[2] == "скажи" and (words[3] == "админу" or words[3] == "админам") then
local message = {}
for i = 4, #words do
table.insert(message, words[i])
end
for i = 1, #administrators do
tellraw("@a[name=" .. administrators[i] .. "]", "Вам отправили личное сообщение как администратору. Прочтите через /mail read.")
execute("/mail send " .. administrators[i] .. " <От " .. nickname .. "> " .. table.concat(message, " "))
end
elseif words[2] == "очисти" and words[3] == "чат" then
tellraw("@a[name=" .. nickname .. "]", string.rep(" ", 3000))
tellraw("@a[name=" .. nickname .. "]", "Чат очищен.")
elseif synonym(words[2], "вруби", "включи") and synonym(words[3], "электричество", "свет") then
if checkNicknameForAdminRights(nickname) then
tellraw("@a", "Серверное освещение включено по приказу " .. nickname)
redstone.setOutput(sides.bottom, 15)
end
elseif synonym(words[2], "выруби", "выключи", "отключи") and synonym(words[3], "электричество", "свет") then
if checkNicknameForAdminRights(nickname) then
tellraw("@a", "Серверное освещение отключено по приказу " .. nickname)
redstone.setOutput(sides.bottom, 0)
end
elseif synonym(words[2], "хеш", "зашифруй", "хешируй") then
if words[3] then
tellraw("@a[name=" .. nickname .. "]", "SHA2-256 HASH: " .. sha.hash(words[3]))
else
tellraw("@a[name=" .. nickname .. "]", "Что тебе захешировать?")
end
elseif synonym(words[2], "сделай", "вруби") and synonym(words[3], "день") then
if checkNicknameForAdminRights(nickname) then
tellraw("@a", "Установлено дневное время по приказу " .. nickname)
execute("/time set 0")
end
elseif synonym(words[2], "сделай", "вруби") and synonym(words[3], "ночь") then
if checkNicknameForAdminRights(nickname) then
tellraw("@a", "Установлено ночное время по приказу " .. nickname)
execute("/time set 18000")
end
elseif synonym(words[2], "выруби", "отключи") and synonym(words[3], "дождь") then
if checkNicknameForAdminRights(nickname) then
tellraw("@a", "Дождь отключен по приказу " .. nickname)
execute("/minecraft:weather clear")
end
elseif synonym(words[2], "отпизди", "ебни", "убей", "отхуесось", "уничтожь") then
if checkNicknameForAdminRights(nickname) then
if words[3] then
tellraw("@a", "Как прикажешь, мой повелитель. " .. words[3] .. " был убит во имя Высшей Цели.")
execute("/kill " .. words[3])
else
tellraw("@a[name=" .. nickname .. "]", "Скажи только имя - и я уничтожу его.")
end
end
elseif synonym(words[2], "шанс", "вероятность") then
if words[3] then
local strings = {
"Вероятность ",
"Вероятность примерно ",
"Приблизительно ",
"Около ",
"Вероятность почти ",
}
tellraw("@a", strings[math.random(1, #strings)] .. math.random(0, 100) .. "%")
else
tellraw("@a[name=" .. nickname .. "]", "Не указана цель поиска вероятности.")
end
elseif words[2] then
tellraw("@a[name=" .. nickname .. "]", "Команда '" .. (words[2]) .. "' не распознана.")
else
tellraw("@a[name=" .. nickname .. "]", "Чего надо?")
end
end
end
end

View File

@ -17,7 +17,7 @@ local resourcesPath = MineOSCore.getCurrentScriptDirectory()
local modulesPath = resourcesPath .. "Modules/"
local localization = MineOSCore.getLocalization(resourcesPath .. "Localizations/")
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.tabbedWindow(1, 1, 80, 25))
local mainContainer, window = MineOSInterface.addWindow(GUI.tabbedWindow(1, 1, 80, 25))
----------------------------------------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@ module.name = localization.moduleLua
----------------------------------------------------------------------------------------------------------------
module.onTouch = function()
window.contentContainer:deleteChildren()
window.contentContainer:removeChildren()
_G.component = require("component")
_G.computer = require("computer")
@ -33,9 +33,9 @@ module.onTouch = function()
input.textDrawMethod = function(x, y, color, text)
if text == placeholder then
buffer.text(x, y, color, text)
buffer.drawText(x, y, color, text)
else
GUI.highlightString(x, y, 1, input.width - 2, 2, GUI.colors.syntaxHighlighting, GUI.luaSyntaxPatterns, text)
GUI.highlightString(x, y, input.width - 2, 1, 2, GUI.LUA_SYNTAX_PATTERNS, GUI.LUA_SYNTAX_COLOR_SCHEME, text)
end
end
@ -62,7 +62,7 @@ module.onTouch = function()
input.autoComplete.scrollBar.colors.background = 0x666666
input.autoComplete.scrollBar.colors.foreground = 0xAAAAAA
input.autoCompleteVerticalAlignment = GUI.alignment.vertical.top
input.autoCompleteVerticalAlignment = GUI.ALIGNMENT_VERTICAL_TOP
input.autoCompleteEnabled = true
input.autoCompleteMatchMethod = function()
local inputTextLength = unicode.len(input.text)

View File

@ -22,7 +22,7 @@ local floppyImage = image.load(MineOSPaths.icons .. "Floppy.pic")
----------------------------------------------------------------------------------------------------------------
module.onTouch = function()
window.contentContainer:deleteChildren()
window.contentContainer:removeChildren()
local container = window.contentContainer:addChild(GUI.container(1, 1, window.contentContainer.width, window.contentContainer.height))
local y = 2
@ -41,7 +41,7 @@ module.onTouch = function()
if inputField.text and inputField.text:len() > 0 then
proxy.setLabel(inputField.text)
container:delete()
container:remove()
module.onTouch()
end
end
@ -53,7 +53,7 @@ module.onTouch = function()
proxy.remove(list[i])
end
container:delete()
container:remove()
module.onTouch()
end
formatButton.disabled = isReadOnly
@ -63,7 +63,7 @@ module.onTouch = function()
if switch.state then
computer.setBootAddress(proxy.address)
container:delete()
container:remove()
module.onTouch()
end
end
@ -80,7 +80,7 @@ module.onTouch = function()
diskContainer:addChild(GUI.image(3, 1, isReadOnly and floppyImage or HDDImage))
diskContainer:addChild(GUI.label(x, 1, width, 1, 0x2D2D2D, (proxy.getLabel() or "Unknown") .. " (" .. (isBoot and (localization.bootable .. ", ") or "") .. proxy.address .. ")"))
diskContainer:addChild(GUI.progressBar(x, 3, width, 0x66DB80, 0xD2D2D2, 0xD2D2D2, spaceUsed / spaceTotal * 100, true))
diskContainer:addChild(GUI.label(x, 4, width, 1, 0xBBBBBB, localization.free .. " " .. math.roundToDecimalPlaces((spaceTotal - spaceUsed) / 1024 / 1024, 2) .. " MB " .. localization.of .. " " .. math.roundToDecimalPlaces(spaceTotal / 1024 / 1024, 2) .. " MB")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
diskContainer:addChild(GUI.label(x, 4, width, 1, 0xBBBBBB, localization.free .. " " .. math.roundToDecimalPlaces((spaceTotal - spaceUsed) / 1024 / 1024, 2) .. " MB " .. localization.of .. " " .. math.roundToDecimalPlaces(spaceTotal / 1024 / 1024, 2) .. " MB")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + diskContainer.height + 1
end

View File

@ -20,28 +20,28 @@ module.name = localization.moduleRAM
----------------------------------------------------------------------------------------------------------------
module.onTouch = function()
window.contentContainer:deleteChildren()
window.contentContainer:removeChildren()
local cykaPanel = window.contentContainer:addChild(GUI.panel(1, 1, 1, 1, 0xE1E1E1))
local mainLayout = window.contentContainer:addChild(GUI.layout(1, 1, window.contentContainer.width, window.contentContainer.height, 2, 1))
mainLayout:setColumnWidth(1, GUI.sizePolicies.percentage, 0.3)
mainLayout:setColumnWidth(2, GUI.sizePolicies.percentage, 0.7)
mainLayout:setCellFitting(1, 1, true, true)
mainLayout:setCellFitting(2, 1, true, true)
mainLayout:setColumnWidth(1, GUI.SIZE_POLICY_RELATIVE, 0.3)
mainLayout:setColumnWidth(2, GUI.SIZE_POLICY_RELATIVE, 0.7)
mainLayout:setFitting(1, 1, true, true)
mainLayout:setFitting(2, 1, true, true)
local tree = mainLayout:setCellPosition(1, 1, mainLayout:addChild(GUI.tree(1, 1, 1, 1, 0xE1E1E1, 0x3C3C3C, 0x3C3C3C, 0xAAAAAA, 0x3C3C3C, 0xFFFFFF, 0xBBBBBB, 0xAAAAAA, 0xC3C3C3, 0x444444, GUI.filesystemModes.both, GUI.filesystemModes.file)))
local tree = mainLayout:setPosition(1, 1, mainLayout:addChild(GUI.tree(1, 1, 1, 1, 0xE1E1E1, 0x3C3C3C, 0x3C3C3C, 0xAAAAAA, 0x3C3C3C, 0xFFFFFF, 0xBBBBBB, 0xAAAAAA, 0xC3C3C3, 0x444444, GUI.IO_MODE_BOTH, GUI.IO_MODE_FILE)))
local itemsLayout = mainLayout:setCellPosition(2, 1, mainLayout:addChild(GUI.layout(1, 1, 1, 1, 1, 2)))
itemsLayout:setRowHeight(1, GUI.sizePolicies.percentage, 0.6)
itemsLayout:setRowHeight(2, GUI.sizePolicies.percentage, 0.4)
itemsLayout:setCellFitting(1, 1, true, false, 4, 0)
itemsLayout:setCellFitting(1, 2, true, true)
local itemsLayout = mainLayout:setPosition(2, 1, mainLayout:addChild(GUI.layout(1, 1, 1, 1, 1, 2)))
itemsLayout:setRowHeight(1, GUI.SIZE_POLICY_RELATIVE, 0.6)
itemsLayout:setRowHeight(2, GUI.SIZE_POLICY_RELATIVE, 0.4)
itemsLayout:setFitting(1, 1, true, false, 4, 0)
itemsLayout:setFitting(1, 2, true, true)
local infoLabel = itemsLayout:setCellPosition(1, 1, itemsLayout:addChild(GUI.label(1, 1, 1, 1, 0x3C3C3C, "nil")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
local argumentsInputField = itemsLayout:setCellPosition(1, 1, itemsLayout:addChild(GUI.input(1, 1, 1, 3, 0xFFFFFF, 0x666666, 0x888888, 0xFFFFFF, 0x262626, nil, localization.arguments)))
local executeButton = itemsLayout:setCellPosition(1, 1, itemsLayout:addChild(GUI.button(1, 1, 1, 3, 0x3C3C3C, 0xFFFFFF, 0x0, 0xFFFFFF, localization.execute)))
local outputTextBox = itemsLayout:setCellPosition(1, 2, itemsLayout:addChild(GUI.textBox(1, 1, 1, 1, 0xFFFFFF, 0x888888, {"nil"}, 1, 1, 0)))
local infoLabel = itemsLayout:setPosition(1, 1, itemsLayout:addChild(GUI.label(1, 1, 1, 1, 0x3C3C3C, "nil")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local argumentsInputField = itemsLayout:setPosition(1, 1, itemsLayout:addChild(GUI.input(1, 1, 1, 3, 0xFFFFFF, 0x666666, 0x888888, 0xFFFFFF, 0x262626, nil, localization.arguments)))
local executeButton = itemsLayout:setPosition(1, 1, itemsLayout:addChild(GUI.button(1, 1, 1, 3, 0x3C3C3C, 0xFFFFFF, 0x0, 0xFFFFFF, localization.execute)))
local outputTextBox = itemsLayout:setPosition(1, 2, itemsLayout:addChild(GUI.textBox(1, 1, 1, 1, 0xFFFFFF, 0x888888, {"nil"}, 1, 1, 0)))
local function updateList(tree, t, definitionName, offset)
local list = {}

View File

@ -19,13 +19,13 @@ module.name = localization.moduleEvent
----------------------------------------------------------------------------------------------------------------
module.onTouch = function()
window.contentContainer:deleteChildren()
window.contentContainer:removeChildren()
local container = window.contentContainer:addChild(GUI.container(1, 1, window.contentContainer.width, window.contentContainer.height))
local layout = container:addChild(GUI.layout(1, 1, container.width, window.contentContainer.height, 1, 1))
layout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
layout:setCellMargin(1, 1, 0, 1)
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
layout:setMargin(1, 1, 0, 1)
local textBox = layout:addChild(GUI.textBox(1, 1, container.width - 4, container.height - 4, nil, 0x888888, {localization.waitingEvents .. "..."}, 1, 0, 0))
local switch = layout:addChild(GUI.switchAndLabel(1, 1, 27, 6, 0x66DB80, 0x1E1E1E, 0xFFFFFF, 0x2D2D2D, localization.processingEnabled .. ": ", true)).switch

View File

@ -34,7 +34,7 @@ local workpathHistoryCurrent = 0
------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 88, 26, 0xF0F0F0))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 88, 26, 0xF0F0F0))
local titlePanel = window:addChild(GUI.panel(1, 1, 1, 3, 0xE1E1E1))
@ -55,9 +55,6 @@ sidebarContainer.itemsContainer = sidebarContainer:addChild(GUI.container(1, 1,
local searchInput = window:addChild(GUI.input(1, 2, 36, 1, 0xFFFFFF, 0x4B4B4B, 0xA5A5A5, 0xFFFFFF, 0x2D2D2D, nil, MineOSCore.localization.search, true))
local updatingListLabel = window:addChild(GUI.label(1, 4, 1, 1, 0x696969, MineOSCore.localization.updatingFileList):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.center))
updatingListLabel.hidden = true
local iconField = window:addChild(MineOSInterface.iconField(1, 4, 1, 1, 2, 2, 0x3C3C3C, 0x3C3C3C, MineOSPaths.desktop))
local scrollBar = window:addChild(GUI.scrollBar(1, 4, 1, 1, 0xC3C3C3, 0x4B4B4B, iconFieldYOffset, 1, 1, 1, 1, true))
@ -66,8 +63,8 @@ scrollBar.eventHandler = nil
local statusBar = window:addChild(GUI.object(1, 1, 1, 1))
statusBar.draw = function(object)
buffer.square(object.x, object.y, object.width, object.height, 0xFFFFFF, 0x3C3C3C, " ")
buffer.text(object.x + 1, object.y, 0x3C3C3C, string.limit(("root/" .. iconField.workpath):gsub("/+$", ""):gsub("%/+", ""), object.width - 2, "left"))
buffer.drawRectangle(object.x, object.y, object.width, object.height, 0xFFFFFF, 0x3C3C3C, " ")
buffer.drawText(object.x + 1, object.y, 0x3C3C3C, string.limit(("root/" .. iconField.workpath):gsub("/+$", ""):gsub("%/+", ""), object.width - 2, "left"))
end
local sidebarResizer = window:addChild(GUI.resizer(1, 4, 3, 5, 0xFFFFFF, 0x0))
@ -128,11 +125,11 @@ local function newSidebarItem(y, textColor, text, path)
local currentTextColor = textColor
if path == iconField.workpath then
buffer.square(object.x, object.y, object.width, 1, 0x3366CC, 0xFFFFFF, " ")
buffer.drawRectangle(object.x, object.y, object.width, 1, 0x3366CC, 0xFFFFFF, " ")
currentTextColor = 0xFFFFFF
end
buffer.text(object.x + 1, object.y, currentTextColor, string.limit(text, object.width - 2, "center"))
buffer.drawText(object.x + 1, object.y, currentTextColor, string.limit(text, object.width - 2, "center"))
end
object.eventHandler = function(mainContainer, object, e1, ...)
@ -172,7 +169,7 @@ end
updateSidebar = function()
local y = sidebarFromY
sidebarContainer.itemsContainer:deleteChildren()
sidebarContainer.itemsContainer:removeChildren()
newSidebarItem(y, 0x3C3C3C, MineOSCore.localization.favourite)
y = y + 1
@ -181,7 +178,7 @@ updateSidebar = function()
object.onTouch = function(e1, e2, e3, e4, e5)
if e5 == 1 then
local menu = GUI.contextMenu(e3, e4)
local menu = GUI.addContextMenu(mainContainer, e3, e4)
menu:addItem(MineOSCore.localization.removeFromFavourites).onTouch = function()
table.remove(favourites, i)
@ -190,7 +187,7 @@ updateSidebar = function()
MineOSInterface.mainContainer:drawOnScreen()
end
menu:show()
mainContainer:drawOnScreen()
else
onFavouriteTouch(favourites[i].path)
end
@ -229,7 +226,7 @@ updateSidebar = function()
newSidebarItem(y, 0x555555, " " .. name, mountPath).onTouch = function(e1, e2, e3, e4, e5)
if e5 == 1 then
local menu = GUI.contextMenu(e3, e4)
local menu = GUI.addContextMenu(mainContainer, e3, e4)
menu:addItem(MineOSCore.localization.delete).onTouch = function()
table.remove(MineOSCore.properties.FTPConnections, i)
@ -238,7 +235,7 @@ updateSidebar = function()
MineOSInterface.mainContainer:drawOnScreen()
end
menu:show()
mainContainer:drawOnScreen()
else
openFTP(connection.address, connection.port, connection.user, connection.password)
end
@ -323,7 +320,7 @@ FTPButton.onTouch = function()
local userInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x696969, 0xE1E1E1, 0x2D2D2D, us, MineOSCore.localization.networkFTPUser, true))
local passwordInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x696969, 0xE1E1E1, 0x2D2D2D, pa, MineOSCore.localization.networkFTPPassword, true, "*"))
container.layout:addChild(GUI.button(1, 1, 36, 3, 0xA5A5A5, 0xFFFFFF, 0x2D2D2D, 0xE1E1E1, "OK")).onTouch = function()
container:delete()
container:remove()
local port = tonumber(portInput.text)
if port then
@ -428,12 +425,7 @@ end
local overrideUpdateFileList = iconField.updateFileList
iconField.updateFileList = function(...)
iconField.hidden, updatingListLabel.hidden = true, false
MineOSInterface.mainContainer:drawOnScreen()
overrideUpdateFileList(...)
iconField.hidden, updatingListLabel.hidden = false, true
updateScrollBar()
end
@ -454,10 +446,6 @@ local function calculateSizes(width, height)
window.backgroundPanel.localX = sidebarContainer.width + 1
window.backgroundPanel.localY = 4
updatingListLabel.localX = window.backgroundPanel.localX
updatingListLabel.width = window.backgroundPanel.width
updatingListLabel.height = window.backgroundPanel.height
statusBar.localX = sidebarContainer.width + 1
statusBar.localY = height
statusBar.width = window.backgroundPanel.width
@ -483,7 +471,7 @@ window.onResize = function(width, height)
updateFileListAndDraw()
end
sidebarResizer.onResize = function(mainContainer, object, dragWidth, dragHeight)
sidebarResizer.onResize = function(dragWidth, dragHeight)
sidebarContainer.width = sidebarContainer.width + dragWidth
sidebarContainer.width = sidebarContainer.width >= 5 and sidebarContainer.width or 5
calculateSizes(window.width, window.height)

View File

@ -51,13 +51,13 @@ local xScore, yScore = math.floor(bufferWidth / 2 - 6), math.floor(bufferHeight
local function drawColumn(x, upperCornerStartPosition)
local y = 1
buffer.square(x + 1, y, config.columnWidth, upperCornerStartPosition - config.columnPipeHeight, colors.columnMain, 0x0, " ")
buffer.square(x, upperCornerStartPosition - config.columnPipeHeight, config.columnPipeWidth, config.columnPipeHeight, colors.columnAlternative, 0x0, " ")
buffer.drawRectangle(x + 1, y, config.columnWidth, upperCornerStartPosition - config.columnPipeHeight, colors.columnMain, 0x0, " ")
buffer.drawRectangle(x, upperCornerStartPosition - config.columnPipeHeight, config.columnPipeWidth, config.columnPipeHeight, colors.columnAlternative, 0x0, " ")
y = upperCornerStartPosition + config.columnFreeSpace
buffer.square(x, y, config.columnPipeWidth, config.columnPipeHeight, colors.columnAlternative, 0x0, " ")
buffer.drawRectangle(x, y, config.columnPipeWidth, config.columnPipeHeight, colors.columnAlternative, 0x0, " ")
y = y + config.columnPipeHeight
buffer.square(x + 1, y, config.columnWidth, bufferHeight - y + 1, colors.columnMain, 0x0, " ")
buffer.drawRectangle(x + 1, y, config.columnWidth, bufferHeight - y + 1, colors.columnMain, 0x0, " ")
end
local function dieBirdDie()
@ -109,14 +109,14 @@ local function drawBackground()
end
local function drawBird()
buffer.image(xBird, yBird, bird)
buffer.drawImage(xBird, yBird, bird)
end
local function drawBigCenterText(y, textColor, usePseudoShadow, text)
local width = bigLetters.getTextSize(text)
local x = math.floor(bufferWidth / 2 - width / 2)
if usePseudoShadow then buffer.square(x - 2, y - 1, width + 4, 7, colors.scoreTextBackground, 0x0, " ") end
if usePseudoShadow then buffer.drawRectangle(x - 2, y - 1, width + 4, 7, colors.scoreTextBackground, 0x0, " ") end
bigLetters.drawText(x, y, textColor, text)
end
@ -126,7 +126,7 @@ local function drawAll(force)
drawBird()
drawBigCenterText(yScore, colors.scoreText, true,tostring(currentScore))
buffer.draw(force)
buffer.drawChanges(force)
end
local function saveHighScores()
@ -203,7 +203,7 @@ local function finalGUI()
drawAll()
buffer.square(x, y, widthOfBoard, heightOfBoard, colors.board, 0xFFFFFF, " ", 0.3)
buffer.drawRectangle(x, y, widthOfBoard, heightOfBoard, colors.board, 0xFFFFFF, " ", 0.3)
y = y + 2
drawBigCenterText(y, colors.boardText, false, "score")
@ -219,7 +219,7 @@ local function finalGUI()
-- obj.records = { buffer.button(x, y, widthOfBoard, 3, 0xFF9900, colors.buttonText, "Таблица рекордов") }; y = y + 3
obj.exit = { buffer.button(x, y, widthOfBoard, 3, 0x262626, colors.buttonText, "Выход") }; y = y + 3
buffer.draw()
buffer.drawChanges()
end
draw()
@ -228,7 +228,7 @@ local function finalGUI()
local e = {event.pull("touch")}
if clicked(e[3], e[4], obj.retry) then
buffer.button(obj.retry[1], obj.retry[2], widthOfBoard, 3, 0xFFFFFF, 0x000000, "Заново")
buffer.draw()
buffer.drawChanges()
os.sleep(0.2)
currentScore = 0
birdIsAlive = true
@ -242,7 +242,7 @@ local function finalGUI()
elseif clicked(e[3], e[4], obj.exit) then
buffer.button(obj.exit[1], obj.exit[2], widthOfBoard, 3, 0xFFFFFF, 0x000000, "Выход")
buffer.draw()
buffer.drawChanges()
os.sleep(0.2)
buffer.clear(0x262626)
ecs.prepareToExit()

View File

@ -9,11 +9,11 @@ local MineOSCore = require("MineOSCore")
--------------------------------------------------------------------------------------------------------------------
if not component.isAvailable("geolyzer") then
GUI.error("This program requires a geolyzer to work!"); return
GUI.alert("This program requires a geolyzer to work!"); return
end
if not component.isAvailable("hologram") then
GUI.error("This program requires a hologram projector to work!"); return
GUI.alert("This program requires a hologram projector to work!"); return
end
component.gpu.setResolution(component.gpu.maxResolution())
@ -72,7 +72,7 @@ local function progressReport(value, text)
local width = 40
local x, y = math.floor(bufferWidth / 2 - width / 2), math.floor(bufferHeight / 2)
GUI.progressBar(x, y, width, 0x00B6FF, 0xFFFFFF, 0xEEEEEE, value, true, true, text, "%"):draw()
buffer.draw()
buffer.drawChanges()
end
local function updateData(onScreen, onProjector, onGlasses)
@ -122,7 +122,7 @@ mainContainer:addChild(GUI.panel(panelX, 1, panelWidth, bufferHeight, 0x444444))
mainContainer.planetImage = mainContainer:addChild(GUI.image(buttonX, objectY, earthImage))
objectY = objectY + mainContainer.planetImage.image[2] + 1
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xFFFFFF, "GeoScan v2.0")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xFFFFFF, "GeoScan v2.0")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
objectY = objectY + 2
mainContainer.horizontalScanRangeSlider = mainContainer:addChild(GUI.slider(buttonX, objectY, buttonWidth, 0xFFDB80, 0x000000, 0xFFDB40, 0xBBBBBB, 4, 24, 16, false, "Horizontal scan range: "))
@ -132,13 +132,13 @@ mainContainer.verticalScanRangeSlider = mainContainer:addChild(GUI.slider(button
mainContainer.verticalScanRangeSlider.roundValues = true
objectY = objectY + 4
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xFFFFFF, "Rendering properties")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xFFFFFF, "Rendering properties")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
objectY = objectY + 2
mainContainer.minimumHardnessTextBox = mainContainer:addChild(GUI.input(buttonX, objectY, 12, 3, 0x262626, 0xBBBBBB, 0xBBBBBB, 0x262626, 0xFFFFFF, tostring(2.7), nil, true))
mainContainer.maximumHardnessTextBox = mainContainer:addChild(GUI.input(buttonX + 14, objectY, 12, 3, 0x262626, 0xBBBBBB, 0xBBBBBB, 0x262626, 0xFFFFFF, tostring(10), nil, true))
objectY = objectY + 3
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xBBBBBB, "Hardness min Hardness max")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer:addChild(GUI.label(buttonX, objectY, buttonWidth, 1, 0xBBBBBB, "Hardness min Hardness max")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
objectY = objectY + 2
@ -201,7 +201,7 @@ mainContainer.scanButton.onTouch = function()
scanResult[x][z] = component.geolyzer.scan(x, z)
current = current + 1
progressReport(math.ceil(current / total * 100), "Scan progress: ")
buffer.draw()
buffer.drawChanges()
end
end

View File

@ -8,7 +8,7 @@ local MineOSInterface = require("MineOSInterface")
---------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 110, 25, 0xF0F0F0))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 110, 25, 0xF0F0F0))
local yDependencyString = "math.sin(x)"
local xOffset, yOffset, xDrag, yDrag, points = 0, 0, 1, 1
@ -17,8 +17,8 @@ local xOffset, yOffset, xDrag, yDrag, points = 0, 0, 1, 1
window.backgroundPanel.localY, window.backgroundPanel.height = 4, window.backgroundPanel.height - 3
local titlePanel = window:addChild(GUI.panel(1, 1, window.width, 3, 0x2D2D2D))
local layout = window:addChild(GUI.layout(1, 1, window.width, 3, 1, 1))
layout:setCellDirection(1, 1, GUI.directions.horizontal)
layout:setCellSpacing(1, 1, 3)
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
layout:setSpacing(1, 1, 3)
local switchAndLabel = layout:addChild(GUI.switchAndLabel(1, 1, 16, 6, 0x66DB80, 0x1E1E1E, 0xF0F0F0, 0xBBBBBB, "Quants:", false))
local scaleSlider = layout:addChild(GUI.slider(1, 1, 12, 0x66DB80, 0x0, 0xFFFFFF, 0xBBBBBB, 1, 1000, 400, false, "Scale: ", "%"))
@ -35,12 +35,12 @@ graph.draw = function(graph)
local xCenter, yCenter = graph.x + xOffset + graph.width / 2 - 1, graph.y + yOffset + graph.height / 2 - 1
buffer.semiPixelLine(math.floor(graph.x), math.floor(yCenter * 2), math.floor(graph.x + graph.width - 1), math.floor(yCenter * 2), 0xD2D2D2)
buffer.semiPixelLine(math.floor(xCenter), math.floor(graph.y * 2 - 1), math.floor(xCenter), math.floor(graph.y + graph.height - 1) * 2, 0xD2D2D2)
buffer.drawSemiPixelLine(math.floor(graph.x), math.floor(yCenter * 2), math.floor(graph.x + graph.width - 1), math.floor(yCenter * 2), 0xD2D2D2)
buffer.drawSemiPixelLine(math.floor(xCenter), math.floor(graph.y * 2 - 1), math.floor(xCenter), math.floor(graph.y + graph.height - 1) * 2, 0xD2D2D2)
for i = 1, #points - 1 do
local x1, x2, y1, y2 = math.floor(xCenter + points[i].x), math.floor(yCenter - points[i].y + 1) * 2, math.floor(xCenter + points[i + 1].x), math.floor(yCenter - points[i + 1].y + 1) * 2
buffer.semiPixelLine(x1, x2, y1, y2, 0x0)
buffer.drawSemiPixelLine(x1, x2, y1, y2, 0x0)
if switchAndLabel.switch.state then
buffer.semiPixelSet(x1, x2, 0x66DB80)
end
@ -71,7 +71,7 @@ local function update()
})
end
else
GUI.error("Invalid input function")
GUI.alert("Invalid input function")
return
end
end
@ -85,7 +85,7 @@ functionButton.onTouch = function()
yDependencyString = inputField.text
update()
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
@ -109,7 +109,7 @@ window.onResize = function(width, height)
update()
end
graph.eventHandler = function(mainContainer, graph, e1, e2, e3, e4)
graph.eventHandler = function(mainContainer, graph, e1, e2, e3, e4, e5)
if e1 == "touch" then
xDrag, yDrag = e3, e4
elseif e1 == "drag" then

View File

@ -38,7 +38,7 @@ local scrollBar, titleTextBox
------------------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 98, 25, colors.background))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 98, 25, colors.background))
window.backgroundPanel.localX, window.backgroundPanel.localY = 11, 5
window.backgroundPanel.width, window.backgroundPanel.height = window.width - 10, window.height - 4
@ -58,14 +58,14 @@ local function byteFieldDraw(object)
if bytes[index] then
local textColor = colors.backgroundText
if index == selection.from or index == selection.to then
buffer.square(x - object.offset, y, object.elementWidth, 1, index == selection.from and colors.selectionFrom or colors.selectionTo, colors.selectionText, " ")
buffer.drawRectangle(x - object.offset, y, object.elementWidth, 1, index == selection.from and colors.selectionFrom or colors.selectionTo, colors.selectionText, " ")
textColor = colors.selectionText
elseif index > selection.from and index < selection.to then
buffer.square(x - object.offset, y, object.elementWidth, 1, colors.selectionBetween, colors.selectionText, " ")
buffer.drawRectangle(x - object.offset, y, object.elementWidth, 1, colors.selectionBetween, colors.selectionText, " ")
textColor = colors.selectionBetweenText
end
buffer.text(x, y, textColor, object.asChar and string.char(bytes[index]) or string.format("%02X", bytes[index]))
buffer.drawText(x, y, textColor, object.asChar and string.char(bytes[index]) or string.format("%02X", bytes[index]))
else
return object
end
@ -75,7 +75,7 @@ local function byteFieldDraw(object)
local lastLineIndex = index - 1
if lastLineIndex >= selection.from and lastLineIndex < selection.to then
buffer.square(object.x - object.offset, y + 1, object.width, 1, colors.selectionBetween, colors.selectionText, " ")
buffer.drawRectangle(object.x - object.offset, y + 1, object.width, 1, colors.selectionBetween, colors.selectionText, " ")
end
x, y = object.x, y + object.elementHeight
@ -87,7 +87,7 @@ end
local function byteFieldEventHandler(mainContainer, object, e1, e2, e3, e4, e5)
if e1 == "touch" or e1 == "drag" then
if e5 == 1 then
local menu = GUI.contextMenu(e3, e4)
local menu = GUI.addContextMenu(mainContainer, e3, e4)
menu:addItem("Select all").onTouch = function()
selection.from = 1
@ -95,7 +95,9 @@ local function byteFieldEventHandler(mainContainer, object, e1, e2, e3, e4, e5)
mainContainer:drawOnScreen()
end
menu:addSeparator()
menu:addItem("Edit").onTouch = function()
local container = MineOSInterface.addUniversalContainer(mainContainer, "Fill byte range [" .. selection.from .. "; " .. selection.to .. "]")
@ -107,13 +109,14 @@ local function byteFieldEventHandler(mainContainer, object, e1, e2, e3, e4, e5)
bytes[i] = number
end
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
mainContainer:drawOnScreen()
end
menu:addItem("Insert").onTouch = function()
local container = MineOSInterface.addUniversalContainer(mainContainer, "Insert bytes at position " .. selection.from .. "")
@ -134,14 +137,16 @@ local function byteFieldEventHandler(mainContainer, object, e1, e2, e3, e4, e5)
selection.from, selection.to = insertionPosition, insertionPosition + count - 1
end
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
mainContainer:drawOnScreen()
end
menu:addSeparator()
menu:addItem("Delete").onTouch = function()
for i = selection.from, selection.to do
table.remove(bytes, selection.from)
@ -152,7 +157,8 @@ local function byteFieldEventHandler(mainContainer, object, e1, e2, e3, e4, e5)
selection.to = selection.from
end
end
menu:show()
mainContainer:drawOnScreen()
else
local index = (math.ceil((e4 - object.y + 1) / 2) - 1) * 16 + math.ceil((e3 - object.x + 1 + object.offset) / object.elementWidth) + offset
@ -212,7 +218,7 @@ local charField = window:addChild(newByteField(byteField.localX + byteField.widt
local separator = window:addChild(GUI.object(byteField.localX + byteField.width, 5, 1, 21))
separator.draw = function(object)
for i = object.y, object.y + object.height - 1 do
buffer.text(object.x, i, colors.separator, "")
buffer.drawText(object.x, i, colors.separator, "")
end
end
@ -222,23 +228,23 @@ window:addChild(GUI.panel(11, 4, window.width - 10, 1, colors.panel))
-- Vertical
local verticalCounter = window:addChild(GUI.object(1, 4, 10, window.height - 3))
verticalCounter.draw = function(object)
buffer.square(object.x, object.y, object.width, object.height, colors.panel, colors.panelText, " ")
buffer.drawRectangle(object.x, object.y, object.width, object.height, colors.panel, colors.panelText, " ")
local index = offset
for y = 2, object.height - 1, 2 do
local textColor = colors.panelText
if index > selection.from and index < selection.to then
buffer.square(object.x, object.y + y - 1, object.width, 2, colors.panelSeleciton, colors.panelSelecitonText, " ")
buffer.drawRectangle(object.x, object.y + y - 1, object.width, 2, colors.panelSeleciton, colors.panelSelecitonText, " ")
textColor = colors.panelSelecitonText
end
if selection.from >= index and selection.from <= index + 15 or selection.to >= index and selection.to <= index + 15 then
buffer.square(object.x, object.y + y, object.width, 1, colors.selectionFrom, colors.selectionText, " ")
buffer.drawRectangle(object.x, object.y + y, object.width, 1, colors.selectionFrom, colors.selectionText, " ")
textColor = colors.selectionText
end
buffer.text(object.x + 1, object.y + y, textColor, string.format("%08X", index))
buffer.drawText(object.x + 1, object.y + y, textColor, string.format("%08X", index))
index = index + 16
end
@ -251,14 +257,14 @@ window:addChild(GUI.object(13, 4, 62, 1)).draw = function(object)
for x = 1, object.width, 4 do
local textColor = colors.panelText
if counter + 1 > restFrom and counter + 1 < restTo then
buffer.square(object.x + x - 2, object.y, 4, 1, colors.panelSeleciton, colors.selectionText, " ")
buffer.drawRectangle(object.x + x - 2, object.y, 4, 1, colors.panelSeleciton, colors.selectionText, " ")
textColor = colors.panelSelecitonText
elseif restFrom == counter + 1 or restTo == counter + 1 then
buffer.square(object.x + x - 2, object.y, 4, 1, colors.selectionFrom, colors.selectionText, " ")
buffer.drawRectangle(object.x + x - 2, object.y, 4, 1, colors.selectionFrom, colors.selectionText, " ")
textColor = colors.selectionText
end
buffer.text(object.x + x - 1, object.y, textColor, string.format("%02X", counter))
buffer.drawText(object.x + x - 1, object.y, textColor, string.format("%02X", counter))
counter = counter + 1
end
end
@ -280,7 +286,7 @@ titleTextBox = window:addChild(
)
)
titleTextBox.localX = math.floor(window.width / 2 - titleTextBox.width / 2)
titleTextBox:setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
titleTextBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
titleTextBox.eventHandler = nil
local saveFileButton = window:addChild(GUI.adaptiveRoundedButton(titleTextBox.localX - 11, 2, 2, 0, colors.panel, colors.panelSelecitonText, colors.panelSelecitonText, colors.panel, "Save"))
@ -309,13 +315,13 @@ local function load(path)
scrollBar.value, scrollBar.maximumValue = 0, #bytes
status()
else
GUI.error("Failed to open file for reading: " .. tostring(reason))
GUI.alert("Failed to open file for reading: " .. tostring(reason))
end
end
openFileButton.onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.open, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
filesystemDialog:show()
filesystemDialog.onSubmit = function(path)
load(path)
@ -324,8 +330,8 @@ openFileButton.onTouch = function()
end
saveFileButton.onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.save, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
filesystemDialog:show()
filesystemDialog.onSubmit = function(path)
local file = io.open(path, "wb")
@ -335,7 +341,7 @@ saveFileButton.onTouch = function()
end
file:close()
else
GUI.error("Failed to open file for writing: " .. tostring(reason))
GUI.alert("Failed to open file for writing: " .. tostring(reason))
end
end
end

View File

@ -11,7 +11,7 @@ local GUI = require("GUI")
--------------------------------------------------------------------------------------------
if not component.isAvailable("hologram") then
GUI.error("This program needs a Tier 2 holo-projector to work")
GUI.alert("This program needs a Tier 2 holo-projector to work")
return
end
@ -149,7 +149,7 @@ local function drawSymbolOnScreen(x, y, symbol, color)
for j = 1, #symbols[symbol] do
for i = 1, #symbols[symbol][j] do
if symbols[symbol][j][i] == 1 then
buffer.square(xPos, y, 2, 1, color, 0x000000, " ")
buffer.drawRectangle(xPos, y, 2, 1, color, 0x000000, " ")
end
xPos = xPos + 2
end
@ -204,11 +204,11 @@ local function drawOnScreen()
drawText(x, y, date, config.dateColor)
y = y + 9
GUI.label(1, y, buffer.getWidth(), 1, config.dateColor, "Press R to randomize clock color, scroll to change projection scale,"):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top):draw(); y = y + 1
GUI.label(1, y, buffer.getWidth(), 1, config.dateColor, "or press Enter to save and quit"):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top):draw()
GUI.label(1, y, buffer.getWidth(), 1, config.dateColor, "Press R to randomize clock color, scroll to change projection scale,"):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP):draw(); y = y + 1
GUI.label(1, y, buffer.getWidth(), 1, config.dateColor, "or press Enter to save and quit"):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP):draw()
-- GUI.label(1, y, buffer.getWidth(), 1, 0xFFFFFF, ""):draw()
buffer.draw()
buffer.drawChanges()
end
--------------------------------------------------------------------------------------------

View File

@ -10,27 +10,25 @@ local event = require("event")
local unicode = require("unicode")
local keyboard = require("keyboard")
local GUI = require("GUI")
local MineOSPaths = require("MineOSPaths")
local MineOSCore = require("MineOSCore")
local MineOSPaths = require("MineOSPaths")
local MineOSInterface = require("MineOSInterface")
------------------------------------------------------------
local config = {
leftTreeViewWidth = 27,
syntaxColorScheme = GUI.colors.syntaxHighlighting,
syntaxColorScheme = GUI.LUA_SYNTAX_COLOR_SCHEME,
scrollSpeed = 8,
cursorColor = 0x00A8FF,
cursorSymbol = "",
cursorBlinkDelay = 0.5,
doubleClickDelay = 0.4,
screenResolution = {},
enableAutoBrackets = true,
highlightLuaSyntax = true,
enableAutocompletion = true,
linesToShowOpenProgress = 150,
}
config.screenResolution.width, config.screenResolution.height = component.gpu.getResolution()
local openBrackets = {
["{"] = "}",
@ -55,7 +53,7 @@ local cursorBlinkState = false
local scriptCoroutine
local resourcesPath = MineOSCore.getCurrentScriptDirectory()
local configPath = MineOSPaths.applicationData .. "MineCode IDE/Config8.cfg"
local configPath = MineOSPaths.applicationData .. "MineCode IDE/Config9.cfg"
local localization = MineOSCore.getCurrentScriptLocalization()
local findStartFrom
local clipboard
@ -69,12 +67,12 @@ local continue, showBreakpointMessage, showErrorContainer
if fs.exists(configPath) then
config = table.fromFile(configPath)
GUI.colors.syntaxHighlighting = config.syntaxColorScheme
GUI.LUA_SYNTAX_COLOR_SCHEME = config.syntaxColorScheme
end
local mainContainer = GUI.fullScreenContainer()
local codeView = mainContainer:addChild(GUI.codeView(1, 1, 1, 1, lines, 1, 1, 1, {}, {}, config.highlightLuaSyntax, 2))
local codeView = mainContainer:addChild(GUI.codeView(1, 1, 1, 1, 1, 1, 1, {}, {}, GUI.LUA_SYNTAX_PATTERNS, config.syntaxColorScheme, config.syntaxHighlight, lines))
local function convertTextPositionToScreenCoordinates(symbol, line)
return
@ -100,7 +98,7 @@ codeView.draw = function(...)
x <= codeView.codeAreaPosition + codeView.codeAreaWidth - 2 and
y <= codeView.y + codeView.height - 2
then
buffer.text(x, y, config.cursorColor, config.cursorSymbol)
buffer.drawText(x, y, config.cursorColor, config.cursorSymbol)
end
end
end
@ -117,9 +115,9 @@ local topToolBarPanel = topToolBar:addChild(GUI.panel(1, 1, 1, 3, 0xE1E1E1))
local RAMProgressBar = topToolBar:addChild(GUI.progressBar(1, 2, 20, 0x787878, 0xC3C3C3, 0xB4B4B4, 50, true, true, "RAM: ", "%"))
local topLayout = topToolBar:addChild(GUI.layout(1, 1, 1, 3, 1, 1))
topLayout:setCellDirection(1, 1, GUI.directions.horizontal)
topLayout:setCellSpacing(1, 1, 2)
topLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
topLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
topLayout:setSpacing(1, 1, 2)
topLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
local autocomplete = mainContainer:addChild(GUI.autoComplete(1, 1, 36, 7, 0xE1E1E1, 0xA5A5A5, 0x3C3C3C, 0x3C3C3C, 0xA5A5A5, 0xE1E1E1, 0xC3C3C3, 0x4B4B4B))
@ -127,25 +125,25 @@ local addBreakpointButton = topLayout:addChild(GUI.adaptiveButton(1, 1, 3, 1, 0x
local syntaxHighlightingButton = topLayout:addChild(GUI.adaptiveButton(1, 1, 3, 1, 0xD2D2D2, 0x4B4B4B, 0x696969, 0xE1E1E1, ""))
syntaxHighlightingButton.switchMode = true
syntaxHighlightingButton.pressed = codeView.highlightLuaSyntax
syntaxHighlightingButton.pressed = codeView.syntaxHighlight
local runButton = topLayout:addChild(GUI.adaptiveButton(1, 1, 3, 1, 0x4B4B4B, 0xE1E1E1, 0xD2D2D2, 0x4B4B4B, ""))
local title = topLayout:addChild(GUI.textBox(1, 1, 1, 3, 0x0, 0x0, {}, 1):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
local title = topLayout:addChild(GUI.textBox(1, 1, 1, 3, 0x0, 0x0, {}, 1):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local titleLines = {}
local titleDebugMode = false
title.draw = function()
local sides = titleDebugMode and 0xCC4940 or 0x5A5A5A
buffer.square(title.x, 2, 1, title.height, sides, 0x0, " ")
buffer.square(title.x + title.width - 1, 2, 1, title.height, sides, 0x0, " ")
buffer.square(title.x + 1, 2, title.width - 2, 3, titleDebugMode and 0x880000 or 0x3C3C3C, 0xE1E1E1, " ")
buffer.drawRectangle(title.x, 2, 1, title.height, sides, 0x0, " ")
buffer.drawRectangle(title.x + title.width - 1, 2, 1, title.height, sides, 0x0, " ")
buffer.drawRectangle(title.x + 1, 2, title.width - 2, 3, titleDebugMode and 0x880000 or 0x3C3C3C, 0xE1E1E1, " ")
if titleDebugMode then
local text = lastErrorLine and localization.runtimeError or localization.debugging .. (_G.MineCodeIDEDebugInfo and _G.MineCodeIDEDebugInfo.line or "N/A")
buffer.text(math.floor(title.x + title.width / 2 - unicode.len(text) / 2), 3, 0xE1E1E1, text)
buffer.drawText(math.floor(title.x + title.width / 2 - unicode.len(text) / 2), 3, 0xE1E1E1, text)
else
for i = 1, #titleLines do
buffer.text(math.floor(title.x + title.width / 2 - unicode.len(titleLines[i]) / 2), i + 1, 0xE1E1E1, titleLines[i])
buffer.drawText(math.floor(title.x + title.width / 2 - unicode.len(titleLines[i]) / 2), i + 1, 0xE1E1E1, titleLines[i])
end
end
end
@ -169,7 +167,7 @@ local searchInput = bottomToolBar:addChild(GUI.input(7, 1, 10, 3, 0xE1E1E1, 0x96
local searchButton = bottomToolBar:addChild(GUI.adaptiveButton(1, 1, 3, 1, 0x3C3C3C, 0xE1E1E1, 0xB4B4B4, 0x2D2D2D, localization.find))
local leftTreeView = mainContainer:addChild(GUI.filesystemTree(1, 1, config.leftTreeViewWidth, 1, 0xD2D2D2, 0x3C3C3C, 0x3C3C3C, 0x969696, 0x3C3C3C, 0xE1E1E1, 0xB4B4B4, 0xA5A5A5, 0xB4B4B4, 0x4B4B4B, GUI.filesystemModes.both, GUI.filesystemModes.file))
local leftTreeView = mainContainer:addChild(GUI.filesystemTree(1, 1, config.leftTreeViewWidth, 1, 0xD2D2D2, 0x3C3C3C, 0x3C3C3C, 0x969696, 0x3C3C3C, 0xE1E1E1, 0xB4B4B4, 0xA5A5A5, 0xB4B4B4, 0x4B4B4B, GUI.IO_MODE_BOTH, GUI.IO_MODE_FILE))
local leftTreeViewResizer = mainContainer:addChild(GUI.resizer(1, 1, 3, 5, 0x696969, 0x0))
@ -498,52 +496,17 @@ local function removeWindowsLineEndings(text)
return result
end
local function changeResolution(width, height)
buffer.setResolution(width, height)
calculateSizes()
config.screenResolution.width, config.screenResolution.height = width, height
end
local function addFadeContainer(title)
return GUI.addFadeContainer(mainContainer, true, true, title)
local function addBackgroundContainer(title)
return GUI.addBackgroundContainer(mainContainer, true, true, title)
end
local function addInputFadeContainer(title, placeholder)
local container = addFadeContainer(title)
local container = addBackgroundContainer(title)
container.input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, "", placeholder))
return container
end
local function changeResolutionWindow()
local container = addFadeContainer(localization.changeResolution)
local inputFieldWidth = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, tostring(config.screenResolution.width)))
local inputFieldHeight = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, tostring(config.screenResolution.height)))
local maxResolutionWidth, maxResolutionHeight = component.gpu.maxResolution()
inputFieldWidth.validator = function(text)
local number = tonumber(text)
if number and number >= 1 and number <= maxResolutionWidth then return true end
end
inputFieldHeight.validator = function(text)
local number = tonumber(text)
if number and number >= 1 and number <= maxResolutionHeight then return true end
end
container.panel.eventHandler = function(mainContainer, object, e1)
if e1 == "touch" then
config.screenResolution.width, config.screenResolution.height = tonumber(inputFieldWidth.text), tonumber(inputFieldHeight.text)
saveConfig()
container:delete()
changeResolution(config.screenResolution.width, config.screenResolution.height)
mainContainer:drawOnScreen()
end
end
mainContainer:drawOnScreen()
end
local function newFile()
autocompleteDatabase = {}
lines = {""}
@ -565,7 +528,7 @@ local function loadFile(path)
local container = mainContainer:addChild(GUI.container(codeView.localX, codeView.localY, codeView.width, codeView.height))
container:addChild(GUI.panel(1, 1, container.width, container.height, 0x1E1E1E))
local layout = container:addChild(GUI.layout(1, 1, container.width, container.height, 1, 1))
layout:addChild(GUI.label(1, 1, layout.width, 1, 0xD2D2D2, localization.openingFile .. " " .. path):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
layout:addChild(GUI.label(1, 1, layout.width, 1, 0xD2D2D2, localization.openingFile .. " " .. path):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local progressBar = layout:addChild(GUI.progressBar(1, 1, 36, 0x969696, 0x2D2D2D, 0x787878, 0, true, true, "", "%"))
local counter, currentSize, totalSize = 1, 0, fs.size(path)
@ -592,13 +555,13 @@ local function loadFile(path)
end
codeView.hidden = false
container:delete()
container:remove()
updateAutocompleteDatabaseFromFile()
updateTitle()
file:close()
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -611,7 +574,7 @@ local function saveFile(path)
end
file:close()
else
GUI.error("Failed to open file for writing: " .. tostring(reason))
GUI.alert("Failed to open file for writing: " .. tostring(reason))
end
end
@ -621,7 +584,7 @@ local function gotoLineWindow()
container.input.onInputFinished = function()
if container.input.text:match("%d+") then
gotoLine(tonumber(container.input.text))
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
@ -630,8 +593,8 @@ local function gotoLineWindow()
end
local function openFileWindow()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.open, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
filesystemDialog.onSubmit = function(path)
loadFile(path)
mainContainer:drawOnScreen()
@ -640,8 +603,8 @@ local function openFileWindow()
end
local function saveFileAsWindow()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.save, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
filesystemDialog.onSubmit = function(path)
saveFile(path)
leftTreeView:updateFileList()
@ -681,10 +644,10 @@ local function downloadFileFromWeb()
newFile()
lines, codeView.maximumLineLength = splitStringIntoLines(result)
else
GUI.error("Failed to connect to URL: " .. tostring(reason))
GUI.alert("Failed to connect to URL: " .. tostring(reason))
end
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
@ -820,7 +783,7 @@ local function pizda(lines, debug)
titleDebugMode = false
updateHighlights()
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
@ -844,7 +807,7 @@ local function pizda(lines, debug)
continue()
end
textBox:setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
end
backgroundObject.eventHandler = function(mainContainer, object, e1)
@ -913,7 +876,7 @@ local function launchWithArgumentsWindow()
table.insert(arguments, argument)
end
container:delete()
container:remove()
mainContainer:drawOnScreen()
run(table.unpack(arguments))
@ -1016,10 +979,12 @@ local function selectAndPasteColor()
startColor = tonumber(unicode.sub(lines[codeView.selections[1].from.line], codeView.selections[1].from.symbol, codeView.selections[1].to.symbol)) or startColor
end
local palette = GUI.addPaletteWindowToContainer(mainContainer, startColor)
palette.onSubmit = function()
palette:delete()
local palette = mainContainer:addChild(GUI.addPalette(1, 1, startColor))
palette.localX, palette.localY = math.floor(mainContainer.width / 2 - palette.width / 2), math.floor(mainContainer.height / 2 - palette.height / 2)
palette.submitButton.onTouch = function()
paste(string.format("0x%06X", palette.color.integer), true)
mainContainer:drawOnScreen()
end
end
@ -1249,7 +1214,7 @@ local function find()
return
end
else
GUI.error("Wrong searching regex")
GUI.alert("Wrong searching regex")
end
end
@ -1280,7 +1245,7 @@ local function toggleTopToolBar()
end
local function createEditOrRightClickMenu(x, y)
local menu = GUI.contextMenu(x, y)
local menu = GUI.addContextMenu(mainContainer, x, y)
menu:addItem(localization.cut, not codeView.selections[1], "^X").onTouch = function()
cut()
@ -1347,7 +1312,7 @@ local function createEditOrRightClickMenu(x, y)
clearBreakpoints()
end
menu:show()
mainContainer:drawOnScreen()
end
codeView.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5)
@ -1450,9 +1415,6 @@ codeView.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5)
-- Delete
elseif e4 == 211 then
deleteLine(cursorPositionLine)
-- R
elseif e4 == 19 then
changeResolutionWindow()
-- F5
elseif e4 == 63 then
launchWithArgumentsWindow()
@ -1571,10 +1533,10 @@ end
local topMenuMineCode = topMenu:addItem("MineCode", 0x0)
topMenuMineCode.onTouch = function()
local menu = GUI.contextMenu(topMenuMineCode.x, topMenuMineCode.y + 1)
local menu = GUI.addContextMenu(mainContainer, topMenuMineCode.x, topMenuMineCode.y + 1)
menu:addItem(localization.about).onTouch = function()
local container = addFadeContainer(localization.about)
local container = addBackgroundContainer(localization.about)
local about = {
"MineCode IDE",
@ -1596,7 +1558,7 @@ topMenuMineCode.onTouch = function()
}
local textBox = container.layout:addChild(GUI.textBox(1, 1, 36, #about, nil, 0xB4B4B4, about, 1, 0, 0, true, false))
textBox:setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
textBox:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
textBox.eventHandler = nil
mainContainer:drawOnScreen()
@ -1606,12 +1568,12 @@ topMenuMineCode.onTouch = function()
mainContainer:stopEventHandling()
end
menu:show()
mainContainer:drawOnScreen()
end
local topMenuFile = topMenu:addItem(localization.file)
topMenuFile.onTouch = function()
local menu = GUI.contextMenu(topMenuFile.x, topMenuFile.y + 1)
local menu = GUI.addContextMenu(mainContainer, topMenuFile.x, topMenuFile.y + 1)
menu:addItem(localization.new, false, "^N").onTouch = function()
newFile()
@ -1642,7 +1604,7 @@ topMenuFile.onTouch = function()
launchWithArgumentsWindow()
end
menu:show()
mainContainer:drawOnScreen()
end
local topMenuEdit = topMenu:addItem(localization.edit)
@ -1652,7 +1614,7 @@ end
local topMenuGoto = topMenu:addItem(localization.gotoCyka)
topMenuGoto.onTouch = function()
local menu = GUI.contextMenu(topMenuGoto.x, topMenuGoto.y + 1)
local menu = GUI.addContextMenu(mainContainer, topMenuGoto.x, topMenuGoto.y + 1)
menu:addItem(localization.pageUp, false, "PgUp").onTouch = function()
pageUp()
@ -1676,22 +1638,22 @@ topMenuGoto.onTouch = function()
gotoLineWindow()
end
menu:show()
mainContainer:drawOnScreen()
end
local topMenuProperties = topMenu:addItem(localization.properties)
topMenuProperties.onTouch = function()
local menu = GUI.contextMenu(topMenuProperties.x, topMenuProperties.y + 1)
local menu = GUI.addContextMenu(mainContainer, topMenuProperties.x, topMenuProperties.y + 1)
menu:addItem(localization.colorScheme).onTouch = function()
local container = GUI.addFadeContainer(mainContainer, true, false, localization.colorScheme)
local container = GUI.addBackgroundContainer(mainContainer, true, false, localization.colorScheme)
local colorSelectorsCount, colorSelectorCountX = 0, 4; for key in pairs(config.syntaxColorScheme) do colorSelectorsCount = colorSelectorsCount + 1 end
local colorSelectorCountY = math.ceil(colorSelectorsCount / colorSelectorCountX)
local colorSelectorWidth, colorSelectorHeight, colorSelectorSpaceX, colorSelectorSpaceY = math.floor(container.width / colorSelectorCountX * 0.8), 3, 2, 1
local startX, y = math.floor(container.width / 2 - (colorSelectorCountX * (colorSelectorWidth + colorSelectorSpaceX) - colorSelectorSpaceX) / 2), math.floor(container.height / 2 - (colorSelectorCountY * (colorSelectorHeight + colorSelectorSpaceY) - colorSelectorSpaceY + 3) / 2)
container:addChild(GUI.label(1, y, container.width, 1, 0xFFFFFF, localization.colorScheme)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 3
container:addChild(GUI.label(1, y, container.width, 1, 0xFFFFFF, localization.colorScheme)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
local x, counter = startX, 1
local colors = {}
@ -1705,7 +1667,7 @@ topMenuProperties.onTouch = function()
local colorSelector = container:addChild(GUI.colorSelector(x, y, colorSelectorWidth, colorSelectorHeight, config.syntaxColorScheme[colors[i][1]], colors[i][1]))
colorSelector.onTouch = function()
config.syntaxColorScheme[colors[i][1]] = colorSelector.color
GUI.colors.syntaxHighlighting = config.syntaxColorScheme
GUI.LUA_SYNTAX_COLOR_SCHEME = config.syntaxColorScheme
saveConfig()
end
@ -1719,7 +1681,7 @@ topMenuProperties.onTouch = function()
end
menu:addItem(localization.cursorProperties).onTouch = function()
local container = addFadeContainer(localization.cursorProperties)
local container = addBackgroundContainer(localization.cursorProperties)
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xC3C3C3, 0x787878, 0x787878, 0xC3C3C3, 0x2D2D2D, config.cursorSymbol, localization.cursorSymbol))
input.onInputFinished = function()
@ -1761,16 +1723,10 @@ topMenuProperties.onTouch = function()
toggleEnableAutocompleteDatabase()
end
menu:addSeparator()
menu:addItem(localization.changeResolution, false, "^R").onTouch = function()
changeResolutionWindow()
end
menu:show()
mainContainer:drawOnScreen()
end
leftTreeViewResizer.onResize = function(mainContainer, object, dragWidth, dragHeight)
leftTreeViewResizer.onResize = function(dragWidth, dragHeight)
leftTreeView.width = leftTreeView.width + dragWidth
calculateSizes()
end
@ -1786,8 +1742,8 @@ addBreakpointButton.onTouch = function()
end
syntaxHighlightingButton.onTouch = function()
codeView.highlightLuaSyntax = not codeView.highlightLuaSyntax
config.highlightLuaSyntax = codeView.highlightLuaSyntax
codeView.syntaxHighlight = not codeView.syntaxHighlight
config.syntaxHighlight = codeView.syntaxHighlight
saveConfig()
mainContainer:drawOnScreen()
end
@ -1847,7 +1803,7 @@ searchButton.onTouch = find
autocomplete:moveToFront()
leftTreeView:updateFileList()
changeResolution(config.screenResolution.width, config.screenResolution.height)
calculateSizes()
updateTitle()
updateRAMProgressBar()
mainContainer:drawOnScreen()

View File

@ -2,10 +2,10 @@
local GUI = require("GUI")
local MineOSInterface = require("MineOSInterface")
local mainContainer, window = MineOSInterface.addWindow(GUI.windowFromContainer(GUI.palette(1, 1, 0x9900FF)))
window.onSubmit = function()
local mainContainer, window = MineOSInterface.addWindow(GUI.palette(1, 1, 0x9900FF))
window.submitButton.onTouch = function()
window:close()
mainContainer:drawOnScreen()
end
window.onCancel = window.onSubmit
window.cancelButton.onTouch = window.submitButton.onTouch

View File

@ -88,7 +88,7 @@ end
local pizdaWidth = 28
mainContainer.sidebarPanel = mainContainer:addChild(GUI.panel(mainContainer.width - pizdaWidth + 1, 2, pizdaWidth, mainContainer.height - 1, 0x3C3C3C))
mainContainer.sidebarLayout = mainContainer:addChild(GUI.layout(mainContainer.sidebarPanel.localX, 2, mainContainer.sidebarPanel.width, mainContainer.sidebarPanel.height, 1, 1))
mainContainer.sidebarLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.sidebarLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
addTitle(mainContainer.sidebarLayout, "Recent colors")
@ -110,8 +110,8 @@ end
local currentToolTitle = addTitle(mainContainer.sidebarLayout, "Tool properties")
mainContainer.currentToolLayout = mainContainer.sidebarLayout:addChild(GUI.layout(1, 1, mainContainer.sidebarLayout.width, 1, 1, 1))
mainContainer.currentToolLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.currentToolLayout:setCellFitting(1, 1, true, false, 2, 0)
mainContainer.currentToolLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
mainContainer.currentToolLayout:setFitting(1, 1, true, false, 2, 0)
local aboutToolTitle = addTitle(mainContainer.sidebarLayout, "About tool")
local aboutToolTextBox = mainContainer.sidebarLayout:addChild(GUI.textBox(1, 1, mainContainer.sidebarLayout.width - 2, 1, nil, 0x787878, {}, 1, 0, 0))
@ -125,8 +125,8 @@ local function onToolTouch(index)
tool = mainContainer.toolsList.itemsLayout.children[index].tool
mainContainer.toolsList:select(index)
mainContainer.currentToolOverlay:deleteChildren()
mainContainer.currentToolLayout:deleteChildren()
mainContainer.currentToolOverlay:removeChildren()
mainContainer.currentToolLayout:removeChildren()
currentToolTitle.hidden = not tool.onSelection
mainContainer.currentToolLayout.hidden = currentToolTitle.hidden
@ -140,7 +140,7 @@ local function onToolTouch(index)
mainContainer.currentToolLayout.height = lastChild.localY + lastChild.height - 1
end
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -175,14 +175,14 @@ for i = 1, #modules do
end
mainContainer.image.draw = function(object)
GUI.windowShadow(object.x, object.y, object.width, object.height, nil, true)
GUI.drawShadow(object.x, object.y, object.width, object.height, nil, true)
local y, text = object.y + object.height + 1, "Size: " .. object.width .. "x" .. object.height
buffer.text(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y, 0x5A5A5A, text)
buffer.drawText(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y, 0x5A5A5A, text)
if savePath then
text = "Path: " .. savePath
buffer.text(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y + 1, 0x5A5A5A, text)
buffer.drawText(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y + 1, 0x5A5A5A, text)
end
local x, y, step, notStep, background, foreground, symbol = object.x, object.y, false, mainContainer.image.width % 2
@ -234,10 +234,10 @@ local function swapColors()
end
local function colorSelectorDraw(object)
buffer.square(object.x + 1, object.y, object.width - 2, object.height, object.color, 0x0, " ")
buffer.drawRectangle(object.x + 1, object.y, object.width - 2, object.height, object.color, 0x0, " ")
for y = object.y, object.y + object.height - 1 do
buffer.text(object.x, y, object.color, "")
buffer.text(object.x + object.width - 1, y, object.color, "")
buffer.drawText(object.x, y, object.color, "")
buffer.drawText(object.x + object.width - 1, y, object.color, "")
end
end
@ -268,7 +268,7 @@ mainContainer.image.eventHandler = function(mainContainer, object, e1, e2, e3, e
local result, reason = pcall(tool.eventHandler, mainContainer, object, e1, e2, e3, e4, ...)
if not result then
GUI.error("Tool eventHandler() failed: " .. reason)
GUI.alert("Tool eventHandler() failed: " .. reason)
end
end
@ -309,7 +309,7 @@ local function new()
container.panel.eventHandler = function(mainContainer, object, e1)
if e1 == "touch" then
newNoGUI(tonumber(widthInput.text), tonumber(heightInput.text))
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
@ -325,7 +325,7 @@ local function loadImage(path)
mainContainer.image.data = result
mainContainer.image.reposition()
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -335,7 +335,7 @@ local function saveImage(path)
savePath = path
addRecentFile(path)
else
GUI.error(reason)
GUI.alert(reason)
end
end
@ -343,15 +343,15 @@ mainContainer.menu:addItem("PE", 0x00B6FF)
local fileItem = mainContainer.menu:addItem("File")
fileItem.onTouch = function()
local menu = GUI.contextMenu(fileItem.x, fileItem.y + 1)
local menu = GUI.addContextMenu(mainContainer, fileItem.x, fileItem.y + 1)
menu:addItem("New").onTouch = new
menu:addSeparator()
menu:addItem("Open").onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.open, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Open", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
filesystemDialog:addExtensionFilter(".pic")
filesystemDialog:expandPath(MineOSPaths.desktop)
filesystemDialog:show()
@ -376,21 +376,21 @@ fileItem.onTouch = function()
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x969696, 0xE1E1E1, 0x2D2D2D, "", "http://example.com/test.pic"))
input.onInputFinished = function()
if #input.text > 0 then
input:delete()
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0x969696, "Downloading file..."):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
input:remove()
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0x969696, "Downloading file..."):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
mainContainer:drawOnScreen()
local temporaryPath = MineOSCore.getTemporaryPath() .. ".pic"
local result, reason = web.download(input.text, temporaryPath)
container:delete()
container:remove()
if result then
loadImage(temporaryPath)
fs.remove(temporaryPath)
savePath = nil
else
GUI.error(reason)
GUI.alert(reason)
end
mainContainer:drawOnScreen()
@ -407,8 +407,8 @@ fileItem.onTouch = function()
end
menu:addItem("Save as").onTouch = function()
local filesystemDialog = GUI.addFilesystemDialogToContainer(mainContainer, 50, math.floor(mainContainer.height * 0.8), true, "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.filesystemModes.save, GUI.filesystemModes.file)
local filesystemDialog = GUI.addFilesystemDialog(mainContainer, true, 50, math.floor(mainContainer.height * 0.8), "Save", "Cancel", "File name", "/")
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
filesystemDialog:addExtensionFilter(".pic")
filesystemDialog:expandPath(MineOSPaths.desktop)
filesystemDialog.filesystemTree.selectedItem = MineOSPaths.desktop
@ -425,7 +425,7 @@ fileItem.onTouch = function()
mainContainer:stopEventHandling()
end
menu:show()
mainContainer:drawOnScreen()
end
mainContainer.menu:addItem("View").onTouch = function()
@ -438,7 +438,7 @@ mainContainer.menu:addItem("View").onTouch = function()
if e1 == "touch" then
config.transparencyBackground, config.transparencyForeground = colorSelector1.color, colorSelector2.color
container:delete()
container:remove()
mainContainer:drawOnScreen()
saveConfig()
end

View File

@ -133,26 +133,26 @@ selector.eventHandler = tool.eventHandler
selector.draw = function()
local step = true
for x = selector.x + 1, selector.x + selector.width - 2 do
buffer.text(x, selector.y, step and 0xFFFFFF or 0x0, "")
buffer.text(x, selector.y + selector.height - 1, step and 0xFFFFFF or 0x0, "")
buffer.drawText(x, selector.y, step and 0xFFFFFF or 0x0, "")
buffer.drawText(x, selector.y + selector.height - 1, step and 0xFFFFFF or 0x0, "")
step = not step
end
step = true
for y = selector.y + 1, selector.y + selector.height - 2 do
buffer.text(selector.x, y, step and 0xFFFFFF or 0x0, "")
buffer.text(selector.x + selector.width - 1, y, step and 0xFFFFFF or 0x0, "")
buffer.drawText(selector.x, y, step and 0xFFFFFF or 0x0, "")
buffer.drawText(selector.x + selector.width - 1, y, step and 0xFFFFFF or 0x0, "")
step = not step
end
buffer.text(selector.x, selector.y, 0x0, "")
buffer.text(selector.x + selector.width - 1, selector.y + selector.height - 1, 0x0, "")
buffer.drawText(selector.x, selector.y, 0x0, "")
buffer.drawText(selector.x + selector.width - 1, selector.y + selector.height - 1, 0x0, "")
buffer.text(selector.x + selector.width - 1, selector.y, 0x0, "")
buffer.text(selector.x, selector.y + selector.height - 1, 0x0, "")
buffer.drawText(selector.x + selector.width - 1, selector.y, 0x0, "")
buffer.drawText(selector.x, selector.y + selector.height - 1, 0x0, "")
buffer.text(touchX, touchY, 0x66FF80, "")
buffer.text(dragX, dragY, 0x66FF80, "")
buffer.drawText(touchX, touchY, 0x66FF80, "")
buffer.drawText(dragX, dragY, 0x66FF80, "")
end
------------------------------------------------------

View File

@ -13,7 +13,7 @@ local x, y, stepX, stepY, buttonWidth, buttonHeight, buttonCount, buttons, curre
local buttonsContainer = GUI.container(1, 1, (buttonWidth + stepX) * buttonCount - stepX, (buttonHeight + stepY) * buttonCount - stepY)
local buttonsLayout = GUI.layout(1, 1, buttonsContainer.width, buttonsContainer.height, 1, 1)
buttonsLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
buttonsLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
buttonsLayout:addChild(buttonsContainer)
local widthInput = GUI.input(1, 1, 1, 1, 0x2D2D2D, 0xC3C3C3, 0x5A5A5A, 0x2D2D2D, 0xD2D2D2, "", "Width")

View File

@ -39,7 +39,7 @@ tool.eventHandler = function(mainContainer, object, e1, e2, e3, e4)
end
end
input:delete()
input:remove()
mainContainer:drawOnScreen()
end

View File

@ -1,132 +0,0 @@
--[[
PNGView
by TehSomeLuigi, 2014
Intended for use with OpenComputers.
Feel free to use however you wish.
This header must however be preserved should this be redistributed, even
if in a modified form.
This software comes with no warranties whatsoever.
]]--
local args = {...}
--package.loaded.libPNGimage = nil
--package.loaded.deflatelua = nil
local term = require("term")
local fs = require("filesystem")
local shell = require("shell")
local component = require("component")
local bit = require("bit32")
local PNGImage = require("libPNGimage")
local out = io.stdout
local err = io.stderr
if not args[1] then
print("Enter filename of PNG Image:")
io.stdout:write(": ")
args[1] = io.read()
elseif args[1] == "-h" or args[1] == "--help" or args[1] == "-?" then
print(" * PNGView Help *")
print("Usage: pngview")
print(" (asks for filename)")
print("Usage: pngview <filename>")
print("Use Ctrl+C to exit once started.")
end
args[1] = shell.resolve(args[1])
if not fs.exists(args[1]) then
io.stderr:write(" * PNGView Error *\n")
io.stderr:write("The file '" .. tostring(args[1]) .. "' does not exist on the filesystem.\n")
return
end
if not component.isAvailable("gpu") then
io.stderr:write(" * PNGView Error *\n")
io.stderr:write("Component API says there is no primary GPU.\n")
return
end
local gpu = component.getPrimary("gpu")
-- now attempt to load the PNG image
-- run in protected call to handle potential errors
local success, pngiOrError = pcall(PNGImage.newFromFile, args[1])
if not success then
io.stderr:write(" * PNGView: PNG Loading Error *\n")
io.stderr:write("While attempting to load '" .. tostring(args[1]) .. "' as PNG, libPNGImage erred:\n")
io.stderr:write(pngiOrError)
return
end
local pngi = pngiOrError
local imgW, imgH = pngi:getSize()
local maxresW, maxresH = gpu.maxResolution()
if imgW > maxresW then
-- in future, we will attempt some scaling or scrolling
io.stderr:write(" * PNGView: PNG Display Error *\n")
io.stderr:write("Resolution not satisfactory: A width resolution of at least " .. imgW .. " is required, only " .. maxresW .. " available:\n")
io.stderr:write(pngiOrError)
return
end
if imgH > maxresH then
-- in future, we will attempt some scaling or scrolling
io.stderr:write(" * PNGView: PNG Display Error *\n")
io.stderr:write("Resolution not satisfactory: A height resolution of at least " .. imgH .. " is required, only " .. maxresH .. " available:\n")
io.stderr:write(pngiOrError)
return
end
local oldResW, oldResH = gpu.getResolution() -- store for later
local oldBackN, oldBackB = gpu.getBackground()
local oldForeN, oldForeB = gpu.getForeground()
local block = string.char(226, 150, 136)
local trans = string.char(226, 150, 145)
gpu.setResolution(maxresW, maxresH)
gpu.setBackground(0x000000, false)
local function drawPngImage(x, y)
for j = 0, imgW-1 do
for i = 0, imgH-1 do
local r, g, b, a = pngi:getPixel(i, j)
if a > 0 then
gpu.setForeground(bit.bor(bit.lshift(r, 16), bit.bor(bit.lshift(g, 8), b)), false)
--gpu.set(x+1, y+1, block)
gpu.fill(x + i * 2, y + j, 2, 1, block)
--print(x, y, r, g, b, a, bit.bor(bit.lshift(r, 16), bit.bor(bit.lshift(g, 8), b)))
--[[else
gpu.setForeground(0x888888, false)
gpu.set(x+1, y+1, trans)
--print(x, y, r, g, b, a, 'tr')
]]
end
--print(x, y, r, g, b, a)
end
end
end
ecs.prepareToExit()
drawPngImage(2, 2)
ecs.waitForTouchOrClick()
gpu.setResolution(oldResW, oldResH)
gpu.setForeground(oldForeN, oldForeB)
gpu.setBackground(oldBackN, oldBackB)

View File

@ -15,7 +15,7 @@ local MineOSCore = require("MineOSCore")
----------------------------------------- cyka -----------------------------------------
if not component.isAvailable("printer3d") then GUI.error("This program requires at least one 3D-printer"); return end
if not component.isAvailable("printer3d") then GUI.alert("This program requires at least one 3D-printer"); return end
local args, options = require("shell").parse(...)
local startImagePath = args[1] == "open" and args[2] or "/MineOS/System/Icons/Steve.pic"
local configPath = MineOSPaths.applicationData .. "PrintImage/Config.cfg"
@ -105,7 +105,7 @@ local function beginPrint()
end
GUI.progressBar(math.floor(buffer.getWidth() / 2 - 25), math.floor(buffer.getHeight() / 2), 50, 0x3366CC, 0xFFFFFF, 0xFFFFFF, math.ceil(counter * 100 / (xShapeCount * yShapeCount)), true, true, "Progress: ", "%"):draw()
buffer.draw()
buffer.drawChanges()
-- else
-- error("Printing out of mainImage range")
end
@ -141,7 +141,7 @@ local function beginPrint()
buffer.clear()
mainContainer:draw()
buffer.draw(true)
buffer.drawChanges(true)
end
----------------------------------------- Window-zaluped parasha -----------------------------------------
@ -174,12 +174,12 @@ local function drawMainImageObject(object)
if mainImage then
local xImage = image.getWidth(mainImage) < buffer.getWidth() and math.floor(buffer.getWidth() / 2 - image.getWidth(mainImage) / 2) or 1
local yImage = image.getHeight(mainImage) < buffer.getHeight() and math.floor(buffer.getHeight() / 2 - image.getHeight(mainImage) / 2) or 1
buffer.image(xImage, yImage, mainImage)
GUI.windowShadow(xImage, yImage, image.getWidth(mainImage), image.getHeight(mainImage), 50, true)
buffer.drawImage(xImage, yImage, mainImage)
GUI.drawShadow(xImage, yImage, image.getWidth(mainImage), image.getHeight(mainImage), 50, true)
if config.showGrid then
for x = xImage, xImage + image.getWidth(mainImage) - 1, shapeResolutionLimit do verticalLine(x, yImage, image.getHeight(mainImage), 0.627) end
for y = yImage, yImage + image.getHeight(mainImage) - 1, shapeResolutionLimit / 2 do horizontalLine(xImage, y, image.getWidth(mainImage), 0.627) end
buffer.text(1, 1, 0xBBBBBB, "хуй")
buffer.drawText(1, 1, 0xBBBBBB, "хуй")
end
end
end
@ -194,7 +194,7 @@ local function createWindow()
mainContainer.shadeContainer:addChild(GUI.panel(1, 1, mainContainer.shadeContainer.width, mainContainer.shadeContainer.height, 0x0000000, 0.4))
local y = 2
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Main properties")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Main properties")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + 2
mainContainer.shadeContainer:addChild(GUI.label(3, y, mainContainer.shadeContainer.width, 1, 0xCCCCCC, "Image path:"))
@ -240,7 +240,7 @@ local function createWindow()
end
y = y + 4
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Frame properties")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Frame properties")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + 2
mainContainer.shadeContainer:addChild(GUI.label(3, y, mainContainer.shadeContainer.width, 1, 0xCCCCCC, "Enabled:"))
local frameSwitch = mainContainer.shadeContainer:addChild(GUI.switch(mainContainer.shadeContainer.width - 9, y, 8, 0xFFDB40, 0xAAAAAA, 0xFFFFFF, config.frame.enabled))
@ -265,7 +265,7 @@ local function createWindow()
frameWidthSlider.roundValues = true
y = y + 5
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Light emission")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Light emission")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + 2
mainContainer.shadeContainer:addChild(GUI.label(3, y, mainContainer.shadeContainer.width, 1, 0xCCCCCC, "Enabled:"))
local lightSwitch = mainContainer.shadeContainer:addChild(GUI.switch(mainContainer.shadeContainer.width - 9, y, 8, 0xFFDB40, 0xAAAAAA, 0xFFFFFF, config.lightEmission.enabled))
@ -283,9 +283,9 @@ local function createWindow()
end
y = y + 5
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Summary information:")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
mainContainer.shadeContainer:addChild(GUI.label(1, y, mainContainer.shadeContainer.width, 1, 0xFFFFFF, "Summary information:")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
y = y + 2
mainContainer.shadeContainer.statusTextBox = mainContainer.shadeContainer:addChild(GUI.textBox(3, y, mainContainer.shadeContainer.width - 4, 5, nil, 0xCCCCCC, {}, 1)):setAlignment(GUI.alignment.horizontal.left, GUI.alignment.vertical.top)
mainContainer.shadeContainer.statusTextBox = mainContainer.shadeContainer:addChild(GUI.textBox(3, y, mainContainer.shadeContainer.width - 4, 5, nil, 0xCCCCCC, {}, 1)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
mainContainer.shadeContainer:addChild(GUI.button(1, mainContainer.shadeContainer.height - 5, mainContainer.shadeContainer.width, 3, 0x363636, 0xFFFFFF, 0xFFFFFF, 0x262626, "Exit")).onTouch = function()
mainContainer:stopEventHandling()

View File

@ -35,12 +35,12 @@ local function settings()
local sliderWidth, textBoxWidth = 43, 19
local x, y = math.floor(window.width / 2 - sliderWidth / 2), math.floor(window.height / 2 - 19)
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, localization.rayEngineProperties)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 3
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, localization.rayEngineProperties)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
local resolutionTextBoxWidth = window:addChild(GUI.input(x, y, textBoxWidth, 3, 0x262626, 0xBBBBBB, 0xBBBBBB, 0x262626, 0xFFFFFF, tostring(buffer.getWidth()), nil, true))
window:addChild(GUI.label(x + textBoxWidth + 2, y + 1, 1, 1, 0xFFFFFF, "X"))
local resolutionTextBoxHeight = window:addChild(GUI.input(x + textBoxWidth + 5, y, textBoxWidth, 3, 0x262626, 0xBBBBBB, 0xBBBBBB, 0x262626, 0xFFFFFF, tostring(buffer.getHeight()), nil, true)); y = y + 4
window:addChild(GUI.label(1, y, window.width, 1, 0xDDDDDD, localization.screenResolution)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 3
window:addChild(GUI.label(1, y, window.width, 1, 0xDDDDDD, localization.screenResolution)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
resolutionTextBoxWidth.validator = function(text) local num = tonumber(text); if num and num >= 40 and num <= 160 then return true end end
resolutionTextBoxHeight.validator = function(text) local num = tonumber(text); if num and num >= 12 and num <= 50 then return true end end
local function onAnyResolutionTextBoxInputFinished()
@ -55,28 +55,28 @@ local function settings()
drawDistanceSlider.onValueChanged = function()
rayEngine.properties.drawDistance = drawDistanceSlider.value
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 4
local shadingDistanceSlider = window:addChild(GUI.slider(x, y, sliderWidth, 0xFFDB80, 0x000000, 0xFFDB40, 0xDDDDDD, 100, 3000, rayEngine.properties.shadingDistance, true, localization.shadingDistance))
shadingDistanceSlider.onValueChanged = function()
rayEngine.properties.shadingDistance = shadingDistanceSlider.value
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 4
local shadingCascadesSlider = window:addChild(GUI.slider(x, y, sliderWidth, 0xFFDB80, 0x000000, 0xFFDB40, 0xDDDDDD, 2, 48, rayEngine.properties.shadingCascades, true, localization.shadingCascades))
shadingCascadesSlider.onValueChanged = function()
rayEngine.properties.shadingCascades = shadingCascadesSlider.value
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 4
local raycastQualitySlider = window:addChild(GUI.slider(x, y, sliderWidth, 0xFFDB80, 0x000000, 0xFFDB40, 0xDDDDDD, 0.5, 32, rayEngine.properties.raycastQuality, true, localization.raycastQuality))
raycastQualitySlider.onValueChanged = function()
rayEngine.properties.raycastQuality = raycastQualitySlider.value
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 4
local currentTimeSlider = window:addChild(GUI.slider(x, y, sliderWidth, rayEngine.world.colors.sky.current, 0x000000, rayEngine.world.colors.sky.current, 0xDDDDDD, 0, rayEngine.world.dayNightCycle.length, rayEngine.world.dayNightCycle.currentTime, true, localization.dayNightCycle, localization.seconds))
@ -86,7 +86,7 @@ local function settings()
currentTimeSlider.colors.active = rayEngine.world.colors.sky.current
currentTimeSlider.colors.pipe = rayEngine.world.colors.sky.current
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 4
window:addChild(GUI.label(x, y, sliderWidth, 1, 0xDDDDDD, localization.enableSemipixelRenderer))
@ -95,7 +95,7 @@ local function settings()
graphonSwitch.onStateChanged = function()
rayEngine.properties.useSimpleRenderer = not graphonSwitch.state
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 3
window:addChild(GUI.label(x, y, sliderWidth, 1, 0xDDDDDD, localization.enableDayNightCycle))
@ -104,12 +104,12 @@ local function settings()
lockTimeSwitch.onStateChanged = function()
rayEngine.world.dayNightCycle.enabled = lockTimeSwitch.state
window:draw()
buffer.draw()
buffer.drawChanges()
end; y = y + 3
window:addChild(GUI.button(x, y, sliderWidth, 3, 0xEEEEEE, 0x262626, 0xBBBBBB, 0x262626, localization.continue)).onTouch = function() window:stopEventHandling(); table.toFile(applicationResourcesDirectory .. "RayEngine.cfg", rayEngine.properties, true) end
window:draw(); buffer.draw(); window:startEventHandling()
window:draw(); buffer.drawChanges(); window:startEventHandling()
end
local function menu()
@ -125,11 +125,11 @@ local function menu()
for file in fs.list(worldsPath) do table.insert(worlds, unicode.sub(file, 1, -2)) end
local x, y = math.floor(window.width / 2 - buttonWidth / 2), math.floor(window.height / 2 - #worlds * (buttonHeight + 1) / 2 - 11)
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, rayWalkVersion)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 3
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, rayWalkVersion)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 3
window:addChild(GUI.button(x, y, buttonWidth, buttonHeight, 0xEEEEEE, 0x262626, 0xBBBBBB, 0x262626, localization.continue)).onTouch = function() window:stopEventHandling() end; y = y + buttonHeight + 1
window:addChild(GUI.button(x, y, buttonWidth, buttonHeight, 0xEEEEEE, 0x262626, 0xBBBBBB, 0x262626, localization.settings)).onTouch = function() window:stopEventHandling(); settings() end; y = y + buttonHeight + 1
window:addChild(GUI.button(x, y, buttonWidth, buttonHeight, 0xEEEEEE, 0x262626, 0x999999, 0x262626, localization.exit)).onTouch = function() buffer.clear(0x000000); buffer.draw(); os.exit() end; y = y + buttonHeight + 1
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, localization.loadWorld)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 2
window:addChild(GUI.button(x, y, buttonWidth, buttonHeight, 0xEEEEEE, 0x262626, 0x999999, 0x262626, localization.exit)).onTouch = function() buffer.clear(0x000000); buffer.drawChanges(); os.exit() end; y = y + buttonHeight + 1
window:addChild(GUI.label(1, y, window.width, 1, 0xFFFFFF, localization.loadWorld)):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 2
for i = 1, #worlds do
window:addChild(GUI.button(x, y, buttonWidth, buttonHeight, 0xEEEEEE, 0x262626, 0xBBBBBB, 0x262626, worlds[i])).onTouch = function() rayEngine.loadWorld(worldsPath .. worlds[i]); window:stopEventHandling() end
@ -139,9 +139,9 @@ local function menu()
local lines = {}; for i = 1, #localization.controlsHelp do table.insert(lines, localization.controlsHelp[i]) end
table.insert(lines, 1, " ")
table.insert(lines, 1, {text = localization.controls, color = 0xFFFFFF})
window:addChild(GUI.textBox(1, y, window.width, #lines, nil, 0xCCCCCC, lines, 1):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)); y = y + #lines + 1
window:addChild(GUI.textBox(1, y, window.width, #lines, nil, 0xCCCCCC, lines, 1):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)); y = y + #lines + 1
window:draw(); buffer.draw(); window:startEventHandling()
window:draw(); buffer.drawChanges(); window:startEventHandling()
end

View File

@ -9,7 +9,7 @@ local MineOSPaths = require("MineOSPaths")
local MineOSCore = require("MineOSCore")
local MineOSInterface = require("MineOSInterface")
if not component.isAvailable("stargate") then
GUI.error("This program requires stargate from mod \"SGCraft\"")
GUI.alert("This program requires stargate from mod \"SGCraft\"")
return
end
local stargate = component.stargate
@ -38,10 +38,10 @@ end
local function chevronDraw(object)
local inactiveColor, activeColor, fadeColor = 0x332400, 0xFFDB00, 0xCC6D00
-- buffer.square(object.x, object.y, object.width, object.height, object.isActivated and fadeColor or inactiveColor)
-- buffer.square(object.x + 1, object.y, 3, object.height, object.isActivated and activeColor or inactiveColor)
-- buffer.text(object.x + 2, object.y + 1, object.isActivated and 0x0 or 0xFFFFFF, object.text)
buffer.image(object.x, object.y, object.isActivated and Ch1Image or Ch2Image)
-- buffer.drawRectangle(object.x, object.y, object.width, object.height, object.isActivated and fadeColor or inactiveColor)
-- buffer.drawRectangle(object.x + 1, object.y, 3, object.height, object.isActivated and activeColor or inactiveColor)
-- buffer.drawText(object.x + 2, object.y + 1, object.isActivated and 0x0 or 0xFFFFFF, object.text)
buffer.drawImage(object.x, object.y, object.isActivated and Ch1Image or Ch2Image)
return object
end
@ -118,12 +118,12 @@ local function newThing(x, y, width, height)
object.draw = function(object)
local x, y = object.x + object.width - 1, math.floor(object.y + object.height / 2)
for i = object.y, object.y + object.height - 1 do
buffer.text(x, i, 0xEEEEEE, "")
buffer.drawText(x, i, 0xEEEEEE, "")
end
for i = object.x, object.x + width - 1 do
buffer.text(i, y, 0xEEEEEE, "")
buffer.drawText(i, y, 0xEEEEEE, "")
end
buffer.text(x, y, 0xEEEEEE, "")
buffer.drawText(x, y, 0xEEEEEE, "")
end
return object
@ -159,8 +159,8 @@ addChevron(79, 30)
mainContainer:addChild(newThing(mainContainer.SGImage.localX + mainContainer.SGImage.width, y, mainContainer.width - mainContainer.SGImage.localX - mainContainer.SGImage.width - width - 7, height))
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Stargate " .. stargate.localAddress())):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 1
mainContainer.connectedToLabel = mainContainer:addChild(GUI.label(x, y, width, 1, 0x555555, "(Not connected)")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 2
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Stargate " .. stargate.localAddress())):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 1
mainContainer.connectedToLabel = mainContainer:addChild(GUI.label(x, y, width, 1, 0x555555, "(Not connected)")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 2
mainContainer.connectionButton = mainContainer:addChild(GUI.framedButton(x, y, width, 3, 0xEEEEEE, 0xEEEEEE, 0xBBBBBB, 0xBBBBBB, "Connect")); y = y + 3
-- mainContainer.connectionButton.animated = false
mainContainer.connectionButton.onTouch = function()
@ -172,7 +172,7 @@ mainContainer.connectionButton.onTouch = function()
dial(input.text)
contacts.last = input.text
saveContacts()
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
@ -205,7 +205,7 @@ mainContainer.messageContactButton.onTouch = function()
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xEEEEEE, 0x666666, 0x666666, 0xEEEEEE, 0x262626, nil, "Type message text here"))
input.onInputFinished = function()
if input.text then
container:delete()
container:remove()
stargate.sendMessage(input.text)
mainContainer:drawOnScreen()
@ -221,7 +221,7 @@ mainContainer.messageContactButton.onTouch = function()
mainContainer:drawOnScreen()
end
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Contacts")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 2
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Contacts")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 2
mainContainer.contactsComboBox = mainContainer:addChild(GUI.comboBox(x, y, width, 3, 0x3C3C3C, 0xBBBBBB, 0x555555, 0x888888)); y = y + 4
mainContainer.connectContactButton = mainContainer:addChild(GUI.framedButton(x, y, width, 3, 0xEEEEEE, 0xEEEEEE, 0xBBBBBB, 0xBBBBBB, "Connect")); y = y + 3
@ -252,7 +252,7 @@ mainContainer.addContactButton.onTouch = function()
updateButtons()
end
container:delete()
container:remove()
mainContainer:drawOnScreen()
end
end
@ -273,7 +273,7 @@ mainContainer.removeContactButton.onTouch = function()
end
end
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Energy to dial")):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top); y = y + 2
mainContainer:addChild(GUI.label(x, y, width, 1, 0xEEEEEE, "Energy to dial")):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP); y = y + 2
mainContainer.fuelProgressBar = mainContainer:addChild(GUI.progressBar(x, y, width, 0xBBBBBB, 0x0, 0xEEEEEE, 100, true, true, "", "%")); y = y + 3
mainContainer.exitButton = mainContainer:addChild(GUI.framedButton(x, y, width, 3, 0xEEEEEE, 0xEEEEEE, 0xBBBBBB, 0xBBBBBB, "Exit")); y = y + 4
mainContainer.exitButton.onTouch = function()
@ -297,7 +297,7 @@ mainContainer.eventHandler = function(mainContainer, object, e1, e2, e3, e4)
mainContainer:drawOnScreen()
end
elseif e1 == "sgMessageReceived" then
GUI.error(e3)
GUI.alert(e3)
end
end
@ -307,5 +307,5 @@ update()
updateChevrons(stargate.stargateState() == "Connected")
mainContainer:draw()
buffer.draw(true)
buffer.drawChanges(true)
mainContainer:startEventHandling()

View File

@ -21,7 +21,7 @@ local recent = {
--------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 90, 23, 0xE1E1E1))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 90, 23, 0xE1E1E1))
local sidePanel = window:addChild(GUI.panel(1, 1, 17, 1, 0x2D2D2D))
local buttonsContainer = window:addChild(GUI.container(3, 2, 1, 1))
@ -29,8 +29,8 @@ local horizontalResizer = window:addChild(GUI.resizer(1, 1, 10, 3, 0x969696, 0x0
local verticalResizer = window:addChild(GUI.resizer(1, 1, 3, 5, 0x969696, 0x0))
local sideLayout = window:addChild(GUI.layout(1, 4, sidePanel.width, 1, 1, 1))
sideLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
sideLayout:setCellFitting(1, 1, true, false, 2, 0)
sideLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
sideLayout:setFitting(1, 1, true, false, 2, 0)
local texts = {}
for i = 1, 5 do
@ -60,9 +60,9 @@ local function updateChars()
end
local recentLayout = sideLayout:addChild(GUI.layout(1, 1, 1, 1, 1, 1))
recentLayout:setCellDirection(1, 1, GUI.directions.horizontal)
recentLayout:setCellSpacing(1, 1, 0)
recentLayout:setCellAlignment(1, 1, GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
recentLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
recentLayout:setSpacing(1, 1, 0)
recentLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
local function onRecentButtonTouch(mainContainer, object)
fromChar = object.code
@ -110,7 +110,7 @@ window.onResize = function(width, height)
nextButton.localY = height - 2
prevButton.localY = height - 5
buttonsContainer:deleteChildren()
buttonsContainer:removeChildren()
local horizontalCount = math.floor((buttonsContainer.width + horizontalSpacing) / (buttonWidth + horizontalSpacing))
local verticalCount = math.floor((buttonsContainer.height + verticalSpacing) / (buttonHeight + verticalSpacing))
@ -184,11 +184,11 @@ gotoInput.onInputFinished = function()
end
end
horizontalResizer.onResize = function(mainContainer, object, dragX, dragY)
horizontalResizer.onResize = function(dragX, dragY)
window:resize(window.width, window.height + dragY)
end
verticalResizer.onResize = function(mainContainer, object, dragX, dragY)
verticalResizer.onResize = function(dragX, dragY)
window:resize(window.width + dragX, window.height)
end

View File

@ -49,10 +49,10 @@ local switchButton = layout:addChild(GUI.adaptiveRoundedButton(1, 1, 3, 1, 0x2D2
local toComboBox = layout:addChild(GUI.comboBox(1, 1, elementWidth, 1, 0x2D2D2D, 0xAAAAAA, 0x444444, 0x888888))
local toInputField = layout:addChild(GUI.input(1, 1, elementWidth, 5, 0x2D2D2D, 0x666666, 0x444444, 0x3C3C3C, 0xBBBBBB, nil, nil))
layout:addChild(GUI.label(1, 1, elementWidth, 1, 0xAAAAAA, "API Key:"):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
layout:addChild(GUI.label(1, 1, elementWidth, 1, 0xAAAAAA, "API Key:"):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
local APIKeyInputField = layout:addChild(GUI.input(1, 1, elementWidth, 1, 0x1E1E1E, 0x666666, 0x444444, 0x1E1E1E, 0xBBBBBB, config.APIKey, "Введите API Key", true))
local infoLabel = layout:addChild(GUI.label(1, 1, elementWidth, 1, 0xFF6D40, " "):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
local infoLabel = layout:addChild(GUI.label(1, 1, elementWidth, 1, 0xFF6D40, " "):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
------------------------------------------------------------------------------------------------------------------
@ -184,7 +184,8 @@ checkLanguages()
fromComboBox.selectedItem = getLanguageIndex(config.fromLanguage, false)
toComboBox.selectedItem = getLanguageIndex(config.toLanguage, false)
mainContainer:drawOnScreen()
mainContainer:draw()
buffer.drawChanges(true)
mainContainer:startEventHandling()

View File

@ -1 +0,0 @@
return "0nm5b1ju"

View File

@ -15,7 +15,7 @@ local MineOSPaths = require("MineOSPaths")
--------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 130, 30, 0))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 130, 30, 0))
window.backgroundPanel.colors.transparency = 0.2
local weatherContainer = window:addChild(GUI.container(1, 1, 1, 23))
@ -77,12 +77,12 @@ local function newWeather(x, y, day)
local wind = day.speed .. " m/s, " .. (winds[math.round(day.deg / 45)] or "N/A")
local function centerText(y, color, text)
buffer.text(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y, color, text)
buffer.drawText(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y, color, text)
end
object.draw = function()
centerText(object.y, 0xFFFFFF, os.date("%a", day.dt))
buffer.image(object.x + 3, object.y + 2, weatherIcons[type])
buffer.drawImage(object.x + 3, object.y + 2, weatherIcons[type])
centerText(object.y + 7, 0xFFFFFF, temp)
centerText(object.y + 8, 0xDDDDDD, wind)
centerText(object.y + 9, 0xBBBBBB, pressure)
@ -98,15 +98,15 @@ local function updateForecast()
result = json:decode(result)
if result.list then
weatherContainer:deleteChildren()
weatherContainer:removeChildren()
local x, y = 1, 1
local currentDay = result.list[1]
local object = weatherContainer:addChild(GUI.object(x + 2, y, 40, 8))
object.draw = function()
bigLetters.drawText(object.x, object.y, 0xFFFFFF, math.round((currentDay.temp.max + currentDay.temp.min) / 2) .. "°")
buffer.text(object.x, object.y + 6, 0xFFFFFF, result.city.name .. ", " .. result.city.country)
buffer.text(object.x, object.y + 7, 0xFFFFFF, "Population: " .. math.shorten(result.city.population, 2))
buffer.drawText(object.x, object.y + 6, 0xFFFFFF, result.city.name .. ", " .. result.city.country)
buffer.drawText(object.x, object.y + 7, 0xFFFFFF, "Population: " .. math.shorten(result.city.population, 2))
end
y = y + object.height + 1
@ -127,10 +127,10 @@ local function updateForecast()
MineOSInterface.mainContainer:drawOnScreen()
table.toFile(configPath, config)
else
GUI.error(result.message)
GUI.alert(result.message)
end
else
GUI.error("Wrong result. Check city name and try again.")
GUI.alert("Wrong result. Check city name and try again.")
end
end

View File

@ -1,27 +0,0 @@
local args = {...}
local libraries = {
buffer = "doubleBuffering",
image = "image",
fs = "filesystem",
GUI = "GUI",
}
for library in pairs(libraries) do if not _G[library] then _G[library] = require(libraries[library]) end end; libraries = nil
------------------------------------------------------------------------------------------------------------------
buffer.start()
if fs.exists(args[1]) then
local cyka = image.load(args[1])
buffer.clear(0x000000)
buffer.image(1, 1, cyka)
buffer.draw()
if args[2] then
fs.makeDirectory(fs.path(args[2]) or "")
image.save(args[2], cyka, 4)
end
else
GUI.error("Файл \"" .. args[1] .. "\" не существует")
end

View File

@ -1,9 +0,0 @@
local palette = require("palette")
local color = palette.draw()
if color == nil then color = "никакой. Че, серьезно? Вообще ничего не выбрал? Во петух, а?" end
print(" ")
print("Выбранный цвет = "..tostring(color))
print(" ")

View File

@ -1,17 +0,0 @@
local ecs = require("ECSAPI")
local gpu = require("component").gpu
local arg = {...}
if arg[1] == "get" or arg[1] == "show" or arg[1] == "print" or arg[1] == "write" or arg[1] == "info" or arg[1] == "help" then
local max1, max2 = gpu.maxResolution()
local cur1, cur2 = gpu.getResolution()
local scale = cur1 / max1 * 100
print(" ")
print("Maximum resolution: " .. max1 .. "x".. max2)
print("Current resolution: " .. cur1 .. "x" .. cur2)
print(" ")
print("Scale: " .. scale .. "%")
print(" ")
else
ecs.setScale(tonumber(arg[1]) or 1)
end

1987
Documentation/Russian/GUI.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,171 @@
Oписание
======
MineOSInterface - это библиотека, поставляющаяся в комплекте с операционной системой MineOS. Она реализует основные системные виджеты, а также отвечает за все манипуляции с окнами. В качестве интерфейсной основы она использует библиотеки **[GUI](https://github.com/IgorTimofeev/OpenComputers/blob/master/Documentation/GUI.md)** и **[doubleBuffering](https://github.com/IgorTimofeev/OpenComputers/blob/master/Documentation/doubleBuffering.md)**.
Кроме того, она предоставляет таблицу с цветами интерфейса ОС по умолчанию:
![](https://i.imgur.com/xm40hG3.png)
Для произвольного изменения цветов отдельных элементов окон обращайтесь к ним напрямую. К примеру, через:
```lua
<окно>.backgroundPanel.colors.background = 0xFF00FF
```
Основные методы
======
MineOSInterface.**addWindow**( window ): *table* mainContainer, *table* window
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | window | Объект окна, созданный методами, описанными ниже |
Добавляет созданное окно в окружение MineOS, регистрирует его иконку в Dock, устанавливает обработчики событий, а также добавляет ему несколько методов для пользовательской манипуляции.
| Тип свойства | Свойство |Описание |
| ------ | ------ | ------ |
| *function* | :**resize**(*int* width, *int* height) | Изменяет размеры окна на указанные, вызывая при этом callback-функцию .**onResize** |
| *callback-function* | .**onResize**(*int* newWidth, *int* newHeight) | Вызывается при изменении размеров окна. Как правило, этот метод используется для изменения размеров и координат содержимого окна после изменения размеров |
| *function* | :**close**() | Закрывает окно и удаляет его из системного окружения |
| *function* | :**minimize**() | Скрывает окно, однако оставляет возможность обратного показа путем клика на его иконку в Dock |
| *function* | :**maximize**() | Изменяет размеры окна под размер экрана, вызывая при этом callback-функцию .**onResize**. Повторный вызов функции вернет размер окна к прежним значениям. Последующие вызовы будут эквивалентны первым двум |
Примеры реализации описаны ниже.
Методы для создания окон
======
MineOSInterface.**window**( x, y, width, height ): *table* window
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата окна по оси X |
| *int* | x | Координата окна по оси Y |
| *int* | width | Ширина окна |
| *int* | height | Высота окна |
Создает пустое окно без каких-либо элементов интерфейса. Данный объект является шаблоном для всех остальных, описанных ниже.
Пример реализации:
```lua
local GUI = require("GUI")
local MineOSInterface = require("MineOSInterface")
------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.window(1, 1, 88, 25))
window:addChild(GUI.panel(1, 1, window.width, window.height, 0x888888))
```
Результат:
![](https://i.imgur.com/lhrm0z6.png?1)
MineOSInterface.**filledWindow**( x, y, width, height [, color]): *table* window
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата окна по оси X |
| *int* | x | Координата окна по оси Y |
| *int* | width | Ширина окна |
| *int* | height | Высота окна |
| [*int* | color] | Опциональный цвет фоновой панели |
Создает окно с добавленной фоновой панелью, а также кнопками для закрытия/минимизации/максимизации, являющееся наследником *MineOSInterface*.**window**. Если цвет панели не указывается, то используется *MineOSInterface.colors.windows.backgroundPanel*.
| Тип свойства | Свойство |Описание |
| ------ | ------ | ------ |
| *table* | .**backgroundPanel** | Указатель на объект фоновой панели (GUI.**panel**) |
| *table* | .**actionButtons** | Указатель на объект кнопок действия (GUI.**actionButtons**) |
Пример реализации:
```lua
local MineOSInterface = require("MineOSInterface")
------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 88, 25, 0xF0F0F0))
```
Результат:
![](https://i.imgur.com/YlCOx68.png?1)
MineOSInterface.**titledWindow**( x, y, width, height, titleText, [addTitlePanel]): *table* window
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата окна по оси X |
| *int* | x | Координата окна по оси Y |
| *int* | width | Ширина окна |
| *int* | height | Высота окна |
| *string* | titleText | Текст заголовка |
| [*int* | addTitlePanel] | Опциональное добавление подложки под текст заголовка |
Создает окно с текстовым заголовком. Если указан аргумент, добавляющий подложку, то текст будет находиться на сером прямоугольнике.
| Тип свойства | Свойство |Описание |
| ------ | ------ | ------ |
| *table* | .**backgroundPanel** | Указатель на объект фоновой панели (GUI.**panel**) |
| *table* | .**actionButtons** | Указатель на объект кнопок действия (GUI.**actionButtons**) |
| *table* | .**titleLabel** | Указатель на объект лейбла заголовка (GUI.**label**) |
| *table* | .**titlePanel** | Указатель на объект лейбла заголовка (GUI.**panel**). Создается только при наличии соответствующего аргумента |
Пример реализации:
```lua
local MineOSInterface = require("MineOSInterface")
------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.titledWindow(1, 1, 88, 25, "Hello world", true))
```
Результат:
![](https://i.imgur.com/4q7DCDD.png?1)
MineOSInterface.**tabbedWindow**( x, y, width, height ): *table* window
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата окна по оси X |
| *int* | x | Координата окна по оси Y |
| *int* | width | Ширина окна |
| *int* | height | Высота окна |
Создает окно с панелью вкладок по шаблонным цветам.
| Тип свойства | Свойство |Описание |
| ------ | ------ | ------ |
| *table* | .**tabBar** | Указатель на объект панели вкладок (GUI.**tabBar**) |
| *table* | .**backgroundPanel** | Указатель на объект фоновой панели (GUI.**panel**) |
| *table* | .**actionButtons** | Указатель на объект кнопок действия (GUI.**actionButtons**) |
Пример реализации:
```lua
local MineOSInterface = require("MineOSInterface")
------------------------------------------------------------------------------------------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.tabbedWindow(1, 1, 88, 25))
window.tabBar:addItem("Приложения")
window.tabBar:addItem("Библиотеки")
window.tabBar:addItem("Обои")
window.tabBar:addItem("Обновления")
```
Результат:
![](https://i.imgur.com/294FatT.png?1)

View File

@ -0,0 +1,407 @@
| Содержание |
| ----- |
| [О библиотеке](#О-библиотеке) |
| [Установка](#Установка) |
| [Глобальные функции](#Глобальные-функции) |
| [Дополнения библиотеки table](#Дополнения-библиотеки-table) |
| [Дополнения библиотеки string](#Дополнения-библиотеки-string) |
| [Дополнения библиотеки math](#Дополнения-библиотеки-math) |
| [Дополнения библиотеки filesystem (OpenOS)](#Дополнения-библиотеки-filesystem-openos) |
О библиотеке
======
AdvancedLua - библиотека, дополняющая стандартные библиотеки Lua и OpenOS отсутствующими, однако крайне необходимыми в быту функциями: быстрой сериализацией таблиц, определением текущего исполняемого скрипта, переносом строк, округлением чисел, получением сортированных файловых списков, различными методами обработки бинарных данных и т.п.
Установка
======
Исходный код доступен по ссылке: https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/advancedLua.lua
Для загрузки на компьютер вы можете воспользоваться стандартной утилитой **wget**:
wget https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/advancedLua.lua -f
Глобальные функции
======
**getCurrentScript**( ): *string* path
-----------------------------------------------------------
Функция возвращает путь к текущему исполняемому скрипту. Для примера запустим файл **/Test/Main.lua** со следующим содержимым:
```lua
print("Путь к текущему скрипту: " .. getCurrentScript())
```
В результате на экране будет отображен тот самый путь:
```lua
Путь к текущему скрипту: /Test/Main.lua
```
**enum**( ... ): *table* result
-----------------------------------------------------------
Функция принимает строковые аргументы и возвращает таблицу с этими аргументами в виде ключей, а также с их порядковым номером в виде значений. Данная функция создана для удобства, когда нет желания вручную изменять значения полей на нужные:
```lua
local alignment = enum(
"left",
"center",
"right"
)
```
В результате таблица alignment будет иметь следующий вид:
```lua
{
left = 1,
center = 2,
right = 3
}
```
Дополнения библиотеки table
======
table.**serialize**( t, [ pretty, indentationWidth, indentUsingTabs, recursionStackLimit ] ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | t | Таблица, которую необходимо сериализовать |
| *boolean* | pretty | Опциональный аргумент, сериализующий таблицу для наилучшего визуального восприятия человеком. По умолчанию имеет значение false |
| *int* | indentationWidth | Опциональный аргумент, отвечающий за ширину отступа в символах при сериализации в режиме **pretty** |
| *boolean* | indentUsingTabs | Опциональный аргумент, отвечающий за выбор символа отступа при сериализации в режиме **pretty**. По умолчанию имеет значение false |
| *int* | recursionStackLimit | Опциональный аргумент, отвечающий за ограничение стека рекурсии при сериализации таблиц большого размера |
Метод изначально создавался в качестве быстрой альтернативы **/lib/serialization.lua**, поставляемой OpenOS. Он преобразует содержимое таблицы в строку и крайне удобен для сохранения конфигов различного ПО в понятном для человека виде с сохранением исходной структуры таблицы. Для примера рассмотрим следующий код:
```lua
local myTable = {
"Hello",
"world",
abc = 123,
def = "456",
ghi = {
jkl = true,
}
}
print("Обычная сериализация: " .. table.serialize(myTable))
print(" ")
print("Красивая сериализация: " .. table.serialize(myTable, true))
```
В результате выполнения скрипта на экране будет отображена сериализованная структура таблицы :
```lua
Обычная сериализация: {[1]="Hello",[2]="world",["abc"]=123,["def"]="456",["ghi"]={["jkl"]=true}}
Красивая сериализация: {
[1] = "Hello",
[2] = "world",
abc = 123,
def = "456",
ghi = {
jkl = true,
}
}
```
Обращаю ваше внимание, что аргумент **pretty** выполняет несколько дополнительных проверок на тип ключей и значений таблицы, а также генерирует символы переноса строки после каждого значения. Поэтому используйте его только в том случае, когда читабельность результата стоит в приоритете над производительностью.
table.**unserialize**( text ): *table or nil* result, *string* reason
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | text | Строка, созданная методом table.**serialize**() |
Метод пытается десериализовать строковое представление lua-таблицы и вернуть результат. Если это невозможно, то возвращается nil и строка с причиной синтаксической ошибки. Для примера выполним простейшую десериализацию:
```lua
local result = table.unserialize("{ abc = 123 }")
```
В результате таблица result будет иметь следующий вид:
```lua
{
abc = 123
}
```
table.**toFile**( path, ... )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к файлу, в который необходимо записать сериализованный результат |
| - | ... | Множество аргументов, принимаемых функцией table.**serialize**(...) |
Метод аналогичен table.**serialize**(...), однако вместо возвращения строкового результата записывает его в файл. Он крайне удобен для быстрого сохранения конфига ПО без излишних заморочек.
table.**fromFile**( path ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к файлу, содержимое которого необходимо десериализовать |
Метод аналогичен table.**unserialize**(...), однако строковое содержимое он читает напрямую из существующего файла, возвращая десериализованный результат. Опять же, по большей части он применяется для удобной загрузки конфигов ПО.
table.**size**( t ): *int* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | t | Таблица, число ключей которой необходимо вычислить |
Метод возвращает число ключей переданной таблицы. Отличается от варианта **#t** тем, что подсчитывает также ненумерические индексы
table.**contains**( t, object ): *boolean* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | t | Таблица, в которой будет осуществлен поиск объекта |
| *var* | object | Объект, наличие которого в таблице необходимо проверить |
Метод определяет, присутствует ли объект в таблице и возвращает результат
table.**indexOf**( t, object ): *var* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | t | Таблица, в которой будет осуществлен поиск объекта |
| *var* | object | Объект, индекс которого необходимо определить |
Метод возвращает индекс (ключ) переданного объекта. Тип индекса может быть различным в зависимости от структуры таблицы: к примеру, в таблице {abc = 123} число 123 имеет строковый индекс abc
table.**copy**( t ): *table* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | t | Таблица, которую необходимо сдублирвать |
Метод рекурсивно копирует содержимое таблицы t в новую и возвращает результат. Обращаю внимание на то, что таблицы, ссылающиеся сами на себя, не поддерживаются (ограничение стека рекурсии по аналогии с table.**serialize**() пилить было оч оч лень, прости <3)
Дополнения библиотеки string
======
string.**limit**( s, limit, mode, noDots ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | s | Строка, длину которой необходимо ограничить |
| *int* | limit | Максимальная длину строки |
| *string* | mode | Режим ограничения для вставки символа многоточия. Может принимать значения **left**, **center** или **right** |
| *boolean* | noDots | Режим ограничения строки классической обрезкой без использования символа многоточия |
Метод ограничивает строку, вставляя символ многоточия в необходимом месте и возвращая результат. Для примера запустим код:
```lua
print("Ограничение слева: " .. string.limit("HelloBeautifulWorld", 10, "left"))
print("Ограничение по центру: " .. string.limit("HelloBeautifulWorld", 10, "center"))
print("Ограничение справа: " .. string.limit("HelloBeautifulWorld", 10, "right"))
```
В результате на экране будет отображено следующее:
```lua
Ограничение слева: …ifulWorld
Ограничение по центру: Hello…orld
Ограничение справа: HelloBeau…
```
string.**wrap**( s, wrapWidth ): *table* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string/string[]* | s | Строка либо массив строк, которые необходимо перенести по указанной длине |
| *int* | wrapWidth | Максимальная длина строки, на которую следует ориентироваться при переносе |
Метод осуществляет перенос строки с указанным ограничением по длине и возвращает результат в виде таблицы. Если размер отдельно взятого слова превышает указанную длину, то слово будет "разрезано" на составляющие части.
Также поддерживаются символы **\n** для автоматического переноса каретки на новую строку. Для примера рассмотрим код:
```lua
local limit = 20
local text = "Привет, как дела? Сегодня отличный денек для выгула твоей вонючей псины, не так ли, Сэм?\n\nАх, ты уже не тот Сэм, с которым Фродо расплавил кольцо Саурона в самом сердце Роковой Горы"
local lines = string.wrap(text, limit)
print(string.rep("-", limit))
for i = 1, #lines do
print(lines[i])
end
```
В результате на экране будет отображен текст:
```lua
--------------------
Привет, как дела?
Сегодня отличный
денек для выгула
твоей вонючей псины,
не так ли, Сэм?
Ах, ты уже не тот
Сэм, с которым Фродо
расплавил кольцо
Саурона в самом
сердце Роковой Горы
```
string.**unicodeFind**( ... ): ...
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| - | ... | Множество аргументов, аналогичных таковым для функции string.**find**(...) |
Метод аналогичен string.**find**(...), однако позволяет работать с юникодом. Незаменимая штука для русскоговорящей аудитории!
Дополнения библиотеки math
======
math.**round**( number ): *float* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *float* | number | Число, которое необходимо округлить |
Метод округляет число до ближайшего целого и возвращает результат
math.**roundToDecimalPlaces**( number, decimalPlaces ): *float* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *float* | number | Число, которое необходимо округлить |
| *int* | decimalPlaces | Число знаков после запятой у округляемого числа |
Метод округляет число до ближайшего целого, лимитируя результат до указаннонного числа знаков после запятой и возвращает результат
math.**shorten**( number, decimalPlaces ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Число, которое необходимо визуально сократить |
| *int* | decimalPlaces | Число знаков после запятой у результата |
Метод преобразует входное число в строку с приставками "**K**", "**M**", "**B**" и "**T**" в завимости от размера числа. Для примера выполним код:
```lua
print("Сокращенный результат: " .. math.shortenNumber(13484381, 2))
```
В результате на экране отобразится следующее:
```lua
Сокращенный результат: 13.48M
```
math.**getDigitCount**( number ): *int* digitCount
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Число, количество десятичных знаков которого необходимо вычислить |
Метод возвращает количество десятичных знаков в числе. К примеру, в числе **512** их **3**, в числе **1888** их **4**
Дополнения библиотеки bit32
======
bit32.**merge**( number1, number2 ): *int* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number1 | Первое число для склейки |
| *int* | number2 | Второе число для склейки |
Метод "склеивает" два числа и возвращает результат. К примеру, вызов метода с аргументами **0xAA** и **0xBB** вернет число **0xAABB**
bit32.**numberToByteArray**( number ) : *table* byteArray
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Число, которое необходимо преобразовать в байт-массив |
Метод извлекает составляющие байты из числа и возвращает таблицу с ними. К примеру, вызов метода с аргументом **0xAABBCC** вернет таблицу **{0xAA, 0xBB, 0xCC}**
bit32.**numberToFixedSizeByteArray**( number, arraySize ) : *table* byteArray
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Число, которое необходимо преобразовать в байт-массив |
| *int* | arraySize | Фиксированный размер выходного массива |
Метод аналогичен bit32.**numberToByteArray**(), однако размер выходного массива указывается вручную. Если количество байт в числе меньше указанного размера, то выходной массив будет дополнен отсутствующими нулями, в противном случае массив заполнится лишь частью байт числа. К примеру, вызов метода с аргументами **0xAABBCC** и **5** вернет таблицу **{0x00, 0x00, 0xAA, 0xBB, 0xCC}**
bit32.**byteArrayToNumber**( byteArray ) : *int* number
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Байт-массив, который необходимо преобразовать в число |
Метод преобразует байты из переданного массива в целое число. К примеру, вызов метода с аргументом **{0xAA, 0xBB, 0xCC}** вернет число **0xAABBCC**
bit32.**byteArrayToNumber**( byteArray ) : *int* number
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | number | Байт-массив, который необходимо преобразовать в число |
Метод преобразует байты из переданного массива в целое число. К примеру, вызов метода с аргументом **{0xAA, 0xBB, 0xCC}** вернет число **0xAABBCC**
Дополнения библиотеки filesystem (OpenOS)
======
filesystem.**extension**( path ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к файлу, расширение которого необходимо получить |
Метод возвращает строковое расширение файла по указанному пути. К примеру, для файла **/Test/HelloWorld.lua** будет возвращена строка **.lua**
filesystem.**hideExtension**( path ): *string* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к файлу, расширение которого необходимо скрыть |
Метод скрывает расширение файла по указанному пути (если оно имеется) и возвращает строковый результат. К примеру, для файла **/Test/HelloWorld.lua** будет возвращена строка **/Test/HelloWorld**
filesystem.**isFileHidden**( path ): *boolean* result
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к файлу, скрытость которого необходимо проверить |
Метод проверяет, является ли файл скрытым (т.е. начинается ли его название с символа "**.**") и возвращает результат. К примеру, для файла **/Test/.Hello.lua** будет возвращено **true**
filesystem.**sortedList**(path, sortingMethod, [ showHiddenFiles, filenameMatcher, filenameMatcherCaseSensitive ] ): *table* fileList
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | path | Путь к директории, список файлов которой необходимо получить |
| *string* | sortingMethod | Метод сортировки файлов. Может принимать значения **name**, **type** и **date** |
| *boolean* | showHiddenFiles | Опциональный аргумент, отвечающий за включение в список скрытых файлов. По умолчанию имеет значение false |
| *string* | filenameMatcher | Опциональный аргумент, представляющий из себя регулярное выражение, по которому будут отсекаться файлы из списка. К примеру, выражение "**%d+%.lua**" будет включать в список только файлы с расширением **.lua** и имеющие в название исключительно цифры |
| *string* | filenameMatcherCaseSensitive | Опциональный аргумент, позволяющий игнорировать регистр символов при использовании аргумента **filenameMatcher** |
Метод получает список файлов из указанной директории в соответствии с переданными условиями, сортируя их определенным методом. Возвращаемый результат представляет собой классическую нумерически индексированную таблицу:
```lua
{
"bin/",
"lib/",
"home/",
"Main.lua"
}
```
filesystem.**readUnicodeChar**( fileHandle ): *string* char
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *handle* | fileHandle | Открытый файловый дескриптор в бинарном режиме (**rb**) |
Метод читает из файлового дескриптора юникод-символ, используя бинарные операции. Поскольку "чистый" Lua не позволяет работать с юникод-символами при чтении файлов в текстовом режиме, то этот метод крайне полезен при написании собственных форматов данных. Отмечу, что для успешного чтения вы должны быть уверены, что читаемые байт-последовательности из дескриптора **гарантированно** соответствует какому-либо юникод-символу

View File

@ -0,0 +1,20 @@
archive.**pack**( pathToCompressedFile, fileList)
---------------------------------------------------------
> Объединить множество входных файлов и директорий в один файл-пакет без сжатия и потери данных
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | pathToCompressedFile | Путь, по которому результирующий пакет должен быть сохранен |
| *table* | fileList | Массив путей к файлам или директориям, которые должны быть упакованы в пакет |
archive.**unpack**( *string* pathToCompressedFile, *string* pathWhereToUnpack )
---------------------------------------------------------
> Распаковать содержимое пакета, созданного методом .**pack()**, в указанную директорию
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | pathToCompressedFile | Путь к имеющемуся пакету |
| *string* | pathWhereToUnpack | Путь к папке, в которую должна быть произведена распаковка |

View File

@ -0,0 +1,103 @@
О библиотеке
======
Color - библиотека для работы с цветом. Она позволяет осуществлять экструзию и упаковку цветовых каналов, преобразовывать цветовую модель RGB в HSB и наоборот, осуществлять альфа-блендинг, генерировать цветовые переходы и конвертировать цвет в 8-битный формат для палитры OpenComputers.
Установка
======
Исходный код доступен по ссылке: https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/color.lua
Для загрузки на компьютер вы можете воспользоваться стандартной утилитой **wget**:
wget https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/color.lua -f
Работа с цветовыми каналами
======
color.**RGBToInteger**( red, green, blue ): *int* IntegerColor
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *byte* **[0; 255]** | red | Красный цветовой канал |
| *byte* **[0; 255]** | green | Зеленый цветовой канал |
| *byte* **[0; 255]** | blue | Синий цветовой канал |
Метод упаковывает три цветовых канала и возвращает 24-битную целочисленную переменную
color.**integerToRGB**( IntegerColor ): *byte* red, *byte* green, *byte* blue
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | IntegerColor | Цвет в формате 0xRRGGBB |
Метод извлекает и возвращает три цветовых канала из 24-битной целочисленной переменной. Значения возвращаемых данных находятся в диапазоне [0; 255]
Обработка цвета
======
color.**blend**( firstColor, secondColor, secondColorTransparency ): *int* blendedColor
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | firstColor | Первый цвет |
| *int* | secondColor | Второй цвет |
| *float* **[0.0; 1.0]** | secondColorTransparency | Прозрачность второго цвета при наложении |
Метод накладывает второй цвет на первый, учитывая прозрачность второго. К примеру, если на красный цвет 0xFF0000 наложить черный цвет 0x000000 с прозрачностью 0.5, то в результате получится цвет 0x7F0000, то есть, темно-красный
color.**transition**( firstColor, secondColor, position ): *int* transitionColor
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | firstColor | Первый цвет |
| *int* | secondColor | Второй цвет |
| *float* **[0.0; 1.0]** | position | Позиция точки перехода от первого цвета ко второму |
Метод генерирует переходный цвет между первым и вторым цветом, основываясь на аргументе transition, где значение 0.0 эквивалентно первому цвету, а 1.0 - второму. К примеру, если осуществить переход от черного цвета 0x000000 к белому 0xFFFFFF с позицией перехода 0.5, то в результате получится цвет 0x7F7F7F, то есть, серый.
Преобразование цветовых моделей
======
color.**RGBToHSB**( red, green, blue ): *int* hue, *float* saturation, *float* brightness
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *byte* **[0; 255]** | red | Красный цветовой канал |
| *byte* **[0; 255]** | green | Зеленый цветовой канал |
| *byte* **[0; 255]** | blue | Синий цветовой канал |
Метод преобразует три цветовых канала цветовой модели RGB в цветовую модель HSB (HSV) и возвращает соответствующий результат. Значения возвращаемых данных *hue* находится в диапазоне [0; 360], а *saturation* и *brightness* - в диапазоне [0.0; 1.0].
Для удобства также имеется метод color.**integerToHSB**(*int* integerColor): *int* hue, *float* saturation, *float* brightness
color.**HSBToRGB**( hue, saturation, brightness ): *byte* red, *byte* green, *byte* blue
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* **[0; 360]** | hue | Оттенок |
| *float* **[0.0; 1.0]** | saturation | Насыщенность |
| *float* **[0.0; 1.0]** | brightness | Яркость |
Метод преобразует параметры цветовой модели HSB (HSV) в три цветовых канала модели RGB и возвращает соответствующий результат.
Для удобства также имеется метод color.**HSBToInteger**(*int* hue, *float* saturation, *float* brightness): *int* integerColor
Компрессия цвета
======
color.**to8Bit**( 24BitColor ): *byte* 8BitColor
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | 24BitColor | Цвет в формате 0xRRGGBB |
Метод обращается к 256-цветной палитре OpenComputers и возвращает индекс цвета, наилучшим образом соответствующего переданному значению, используя тот же метод поиска, что и в gpu.**setBackground**(color). В результате возвращается переменная в диапазоне [0; 255], которая может быть использована для записи в бинарный файл, позволяя экономить память. Обращаю внимание, что метод медленный, и не подходит для отрисовки графики на экране.
color.**to24Bit**( 8BitColor ): *int* 24BitColor
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | 8BitColor | Индекс палитры OpenComputers |
Метод позволяет осуществить обратное преобразование 8-битного индекса, созданного методом color.**to8Bit**.

View File

@ -0,0 +1,387 @@
| Содержание |
| ----- |
| [О библиотеке](#О-библиотеке) |
| [Установка](#Установка) |
| [Методы библиотеки](#Методы-библиотеки) |
| [buffer.getResolution](#buffergetresolution-int-width-int-height) |
| [buffer.setResolution](#buffersetresolution-width-height-) |
| [buffer.bindScreen](#bufferbindscreen-address-) |
| [buffer.bindGPU](#bufferbindgpu-address-) |
| [Методы отрисовки](#Методы-отрисовки) |
| [buffer.draw](#bufferdraw-force-) |
| [buffer.setDrawLimit](#buffersetdrawlimit-x1-y1-x2-y2-) |
| [buffer.getDrawLimit](#buffergetdrawlimit--int-x1-int-y1-int-x2-int-y2) |
| [buffer.copy](#buffercopy-x-y-width-height--table-pixeldata) |
| [buffer.paste](#bufferpaste-x-y-pixeldata-) |
| [buffer.set](#bufferpaste-x-y-pixeldata-) |
| [buffer.get](#bufferpaste-x-y-pixeldata-) |
| [buffer.square](#buffersquare-x-y-width-height-background-foreground-symbol-transparency-) |
| [buffer.clear](#bufferclear-color-transparency-) |
| [buffer.text](#buffertext-x-y-color-text-transparency-) |
| [buffer.formattedText](#bufferformattedtext-x-y-text-) |
| [buffer.image](#bufferimage-x-y-picture-) |
| [Методы полупиксельной отрисовки:](#Методы-полупиксельной-отрисовки) |
| [buffer.semiPixelSet](#buffersemipixelset-x-y-color-) |
| [buffer.semiPixelSquare](#buffersemipixelsquare-x-y-width-height-color-) |
| [buffer.semiPixelLine](#buffersemipixelline-x1-y1-x2-y2-color-) |
| [buffer.semiPixelCircle](#buffersemipixelcircle-xcenter-ycenter-radius-color-) |
| [buffer.semiPixelBezierCurve](#buffersemipixelbeziercurve-points-color-precision-) |
| [Вспомогательные методы:](#Вспомогательные-методы) |
| [buffer.flush](#bufferflush-width-height-) |
| [buffer.getIndexByCoordinates](#buffergetindexbycoordinates-x-y--int-index) |
| [buffer.getCoordinatesByIndex](#buffergetcoordinatesbyindex-index--int-x-int-y) |
| [buffer.rawSet](#bufferrawset-index-background-foreground-symbol-) |
| [buffer.rawGet](#bufferrawget-index--int-background-int-foreground-char-symbol) |
| [Практический пример #1](#Практический-пример-1) |
О библиотеке
======
DoubleBuffering - низкоуровневая библиотека для эффективного использования ресурсов GPU и отрисовки содержимого экрана с предельно возможной скоростью. К примеру, с ее помощью реализован наш игровой движок с динамическим освещением сцен, а также небольшая игра на алгоритме рейкастинга, выдающие более чем достойные значения FPS:
![Imgur](http://i.imgur.com/YgL9fCo.png?1)
![Imgur](http://i.imgur.com/yHEwiNo.png?1)
Сама суть библиотеки очень проста: в оперативной памяти хранится два массива, содержащих информацию о пикселях на экране. Первый хранит то, что отображено в данный момент, а второй - то, что пользователь желает отрисовать. После осуществления всех операций отрисовки пользователь вызывает метод buffer.**draw**(), затем система автоматически определяет изменившиеся пиксели, группирует их в промежуточный буфер, чтобы число GPU-операций было минимальным, а затем выводит изменения на экран.
По сравнению с стандартной отрисовкой время отображения сокращается в сотни и тысячи раз. На рисунке ниже наглядно показана эффективность библиотеки:
![meow](http://i60.fastpic.ru/big/2015/1026/8a/4c72bfcbe8fbee5993bfd7a058a5f88a.png)
Цена таких космических скоростей - повышенный расход оперативной памяти. Чтобы предельно уменьшить его, мы используем одномерную структуру экранных массивов вместо трехмерной:
![Imgur](http://i.imgur.com/2Pkne53.png)
Для получения данных о пикселях используются специальные методы, преобразующие экранные координаты в индексы экранного буфера и наоборот, подробнее об этом написано ниже в разделе "**Вспомогательные методы**".
Кроме того, библиотека не обращается ни к одной lua-таблице напрямую, заменяя их на переменные-аналоги и избегая при этом расчетов данных хеш-таблиц: к примеру, каждый метод GPU экранирован, и вместо gpu.setBackground используется GPUSetBackground(). При грамотной реализации такой подход колоссально увеличивает производительность, не нагружая при этом Lua GC.
Установка
======
| Библиотека | Функционал |
| ------ | ------ |
| *[advancedLua](https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/advancedLua.lua)* | Дополнение стандартных библиотек Lua множеством функций: быстрой сериализацией таблиц, переносом строк, методами обработки бинарных данных и т.д. |
| *[color](https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/color.lua)* | Экструзия цветовых каналов, альфа-блендинг, поддержка различных палитр и конвертации цвета в 8-битный формат |
| *[image](https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/image.lua)* | Реализация стандарта изображений для OpenComputers и базовые методы их обработки: транспонирование, обрезка, поворот, отражение и т.д. |
| *[OCIF](https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/FormatModules/OCIF.lua)* | Модуль формата изображения OCIF (OpenComputers Image Format) для библиотеки image, написанный с учетом особенностей мода и реализующий эффективное сжатие пиксельных данных |
| *[doubleBuffering](https://github.com/IgorTimofeev/OpenComputers/blob/master/lib/doubleBuffering.lua)* | Данная библиотека |
Вы можете использовать имеющиеся выше ссылки для установки зависимостей вручную или запустить автоматический [установщик](https://pastebin.com/vTM8nbSZ), загружающий все необходимые файлы за вас:
pastebin run vTM8nbSZ
Основные методы
======
buffer.**getResolution**(): *int* width, *int* height
-----------------------------------------------------------
Получить разрешение экранного буфера. Для удобства также имеются методы buffer.**getWidth**() и buffer.**getHeight**().
buffer.**setResolution**( width, height )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | width | Ширина буфера |
| *int* | height | Высота буфера |
Установить разрешение экранного буфера и GPU равным указанному. Содержимое буфера при этом будет заполнено черными пикселями с символом пробела.
buffer.**bindScreen**( address )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | address | Адрес компонента экрана |
Связать используемую буфером видеокарту с указанным адресом компонента экрана. Содержимое буфера при этом будет очищено черными пикселями с символом пробела.
buffer.**bindGPU**( address )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *string* | address | Адрес компонента видеокарты |
Изменить используемую буфером видеокарту на указанную. Содержимое буфера при этом будет очищено черными пикселями с символом пробела.
buffer.**getGPUProxy**( ): *table* GPUProxy
-----------------------------------------------------------
Получить указатель на proxy используемого буфером компонента видеокарты.
Методы отрисовки
======
buffer.**draw**( [force] )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| [*boolean* | force] | Принудительная отрисовка |
Отрисовать содержимое буфера на экран. Если имеется опциональный аргумент *force*, то содержимое буфера будет отрисовано полностью и вне зависимости от изменившихся пикселей.
buffer.**setDrawLimit**( x1, y1, x2, y2 )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x1 | Координата первой точки лимита отрисовки по оси x |
| *int* | y1 | Координата первой точки лимита отрисовки по оси y |
| *int* | x2 | Координата второй точки лимита отрисовки по оси x |
| *int* | y2 | Координата второй точки лимита отрисовки по оси y |
Установить лимит отрисовки буфера до указанного. При этом любые операции, выходящие за границы лимита, будут игнорироваться. По умолчанию буфер всегда имеет лимит отрисовки в диапазонах **x ∈ [1; buffer.width]** и **y ∈ [1; buffer.height]**
buffer.**getDrawLimit**( ): *int* x1, *int* y1, *int* x2, *int* y2
-----------------------------------------------------------
Получить текущий лимит отрисовки.
buffer.**copy**( x, y, width, height ): *table* pixelData
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата копируемой области по оси x |
| *int* | y | Координата копируемой области по оси y |
| *int* | width | Ширина копируемой области |
| *int* | height | Высота копируемой области |
Скопировать содержимое указанной области из буфера и выдать в виде таблицы. Впоследствии можно использовать с buffer.**paste**(...).
buffer.**paste**( x, y, pixelData )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата вставки по оси x |
| *int* | y | Координата вставки по оси y |
| *table* | pixelData | Таблица со скопированной ранее областью буфера |
Вставить скопированное содержимое буфера по указанным координатам.
buffer.**set**( x, y, background, foreground, symbol )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата по оси x |
| *int* | y | Координата по оси y |
| *int* | background | Цвет фона |
| *int* | foreground | Цвет символа |
| *char* | symbol | Символ |
Установить значение конкретного пикселя на экране. Полезно для мелкого и точного редактирования.
buffer.**get**( x, y ): *int* background, *int* foreground, *char* symbol
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата по оси x |
| *int* | y | Координата по оси y |
Получить значение конкретного пикселя на экране.
buffer.**square**( x, y, width, height, background, foreground, symbol, transparency )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата прямоугольника по оси x |
| *int* | y | Координата прямоугольника по оси y |
| *int* | width | Ширина прямоугольника |
| *int* | height | Высота прямоугольника |
| *int* | background | Цвет фона прямоугольника |
| *int* | foreground | Цвет символов прямоугольника |
| *char* | symbol | Символ, которым будет заполнен прямоугольник |
| [*float* | transparency] | Опциональная прозрачность прямоугольника |
Заполнить прямоугольную область указанными данными. При указании прозрачности в диапазоне [0.0; 1.0] прямоугольник будет накладываться поверх существующей информации, словно прозрачное стеклышко.
buffer.**clear**( [color, transparency] )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| [*int* | background] | Опциональный цвет фона |
| [*float* | transparency] | Опциональная прозрачность фона |
Работает как buffer.**square**(...), однако применяется сразу ко всем пикселям буфера. Если аргументов не передается, то буфер заполняется стандартным черным цветом и символом пробела. Удобно для быстрой очистки содержимого буфера.
buffer.**text**( x, y, color, text, transparency )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата текста по оси x |
| *int* | y | Координата текста по оси y |
| *int* | foreground | Цвет текста |
| *string* | text | Текст |
| [*float* | transparency] | Опциональная прозрачность текста |
Нарисовать текст указанного цвета поверх имеющихся пикселей. Цвет фона при этом остается прежним. Можно также указать опциональную прозрачность текста текста в диапазоне [0.0; 1.0].
buffer.**formattedText**( x, y, text )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата текста по оси x |
| *int* | y | Координата текста по оси y |
| *string* | text | Текст |
Аналогичен методу buffer.**text**(), однако поддерживает цветовое форматирование. По умолчанию цвет текста имеет значение 0xFFFFFF, для его изменения используйте синтаксическую вставку вида **\#RRGGBB**. К примеру, "Hello world, **\#FF00FF**this is formatted text!".
buffer.**image**( x, y, picture )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата изображения по оси x |
| *int* | y | Координата изображения по оси y |
| *table* | picture | Загруженное изображение |
Нарисовать загруженное через image.**load**(*string* path) изображение. Альфа-канал изображения также поддерживается.
Методы полупиксельной отрисовки
======
Все методы полупиксельной отрисовки позволяют избежать эффекта удвоения высоты пикселя консольной графики, используя специальные символы наподобие "▄". При этом передаваемые координаты по оси **Y** должны принадлежать промежутку **[0; buffer.height * 2]**.
buffer.**semiPixelSet**( x, y, color )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x1 | Координата пикселя по оси x |
| *int* | y1 | Координата пикселя по оси y |
| *int* | color | Цвет пикселя |
Установка пиксельного значения в указанной точке.
buffer.**semiPixelSquare**( x, y, width, height, color )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата прямоугольника по оси x |
| *int* | y | Координата прямоугольника по оси y |
| *int* | width | Ширина прямоугольника |
| *int* | height | Высота прямоугольника |
| *int* | color | Цвет прямоугольника |
Отрисовка прямоугольника с указанными параметрами.
buffer.**semiPixelLine**( x1, y1, x2, y2, color )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x1 | Координата первой точки линии по оси x |
| *int* | y1 | Координата первой точки линии по оси y |
| *int* | x2 | Координата второй точки линии по оси x |
| *int* | y2 | Координата второй точки линии по оси y |
| *int* | color | Цвет линии |
Растеризация отрезка указанного цвета
buffer.**semiPixelCircle**( xCenter, yCenter, radius, color )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | xCenter | Координата центральной точки окружности по оси x |
| *int* | yCenter | Координата центральной точки окружности по оси y |
| *int* | radius | Радиус окружности |
| *int* | color | Цвет окружности |
buffer.**semiPixelBezierCurve**( points, color, precision )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *table* | points | Таблица вида ```{{x = 32, y = 2}, {x = 2, y = 2}, {x = 2, y = 98}}```, содержащая опорные точки для отрисовки кривой Безье |
| *int* | color | Цвет кривой Безье |
| *float* | precision | Точность отрисовки кривой Безье. Чем меньше - тем точнее |
Растеризация [кривой Безье](https://ru.wikipedia.org/wiki/%D0%9A%D1%80%D0%B8%D0%B2%D0%B0%D1%8F_%D0%91%D0%B5%D0%B7%D1%8C%D0%B5) с указанным цветом.
Вспомогательные методы
======
Ниже перечислены методы, используемые самой библиотекой или приложениями, требующими максимального быстродействия и рассчитывающими пиксельные данные буфера вручную. В большинстве случаев они не пригождаются, однако для ознакомления указаны.
buffer.**flush**( [width, height] )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | width | Ширина буфера |
| *int* | height | Высота буфера |
Метод, устанавливающий разрешение экранного буфера равным указанному и заполняющий его черными пикселями с символом пробела. В отличие от buffer.**setResolution** не изменяет текущего разрешения GPU. Если опциональные аргументы не указаны, то размер буфера становится эквивалентным текущему разрешению GPU.
buffer.**getIndex*( x, y ): int index
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | x | Координата пикселя экрана по оси x |
| *int* | y | Координата пикселя экрана по оси y |
Метод, преобразующий экранные координаты в индекс экраннного буфера. К примеру, пиксель 2x1 имеет индекс буфера 4, а пиксель 3x1 имеет индекс буфера 7.
buffer.**getCoordinates**( index ): int x, int y
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | index | Индекс экранного буфера |
Метод, преобразующий индекс буфера в соответствующие ему координаты на экране.
buffer.**rawSet**( index, background, foreground, symbol )
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | index | Индекс экранного буфера |
| *int* | background | Цвет фона |
| *int* | foreground | Цвет символа |
| *char* | symbol | Символ |
Метод, устанавливающий соответствующие значения цветов и символа пикселю с указанным индексом.
buffer.**rawGet**( index ): int background, int foreground, char symbol
-----------------------------------------------------------
| Тип | Аргумент | Описание |
| ------ | ------ | ------ |
| *int* | index | Индекс экранного буфера |
Метод, возвращающий соответствующие значения цветов и символа пикселя с указанным индексом.
Практический пример
======
```lua
-- Подключаем библиотеки
local buffer = require("doubleBuffering")
local image = require("image")
-----------------------------------------------------------------------------------------------
-- Загружаем и рисуем изображение
buffer.image(1, 1, image.load("/MineOS/Pictures/Raspberry.pic"))
-- Заполняем буфер черным цветом с прозрачностью 0.6, чтобы изображение было чуть темнее
buffer.clear(0x0, 0.6)
-- Рисуем 10 квадратиков, заполненных случайным цветом
local x, y, xStep, yStep = 2, 2, 4, 2
for i = 1, 10 do
buffer.square(x, y, 6, 3, math.random(0x0, 0xFFFFFF), 0x0, " ")
x, y = x + xStep, y + yStep
end
-- Рисуем желтую окружность
buffer.semiPixelCircle(22, 22, 10, 0xFFDB40)
-- Рисуем белую линию
buffer.semiPixelLine(2, 36, 35, 3, 0xFFFFFF)
-- Рисуем зеленую кривую Безье с точностью 0.01
buffer.semiPixelBezierCurve(
{
{ x = 2, y = 63},
{ x = 63, y = 63},
{ x = 63, y = 2}
},
0x44FF44,
0.01
)
-- Выводим содержимое буфера на экран
buffer.draw()
```
Результат:
![Imgur](http://i.imgur.com/wvu0jeh.png?1)

178
Files.cfg
View File

@ -2,63 +2,63 @@
preInstall = {
{
path="/lib/advancedLua.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/advancedLua.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/AdvancedLua/master/AdvancedLua.lua",
fileID=93,
},
{
path="/lib/color.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/color.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/Color/master/Color.lua",
fileID=92,
},
{
path="/lib/FormatModules/OCIF.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/FormatModules/OCIF.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/Image/master/OCIF.lua",
},
{
path="/lib/image.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/image.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/Image/master/Image.lua",
fileID=73,
},
{
path="/lib/doubleBuffering.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/doubleBuffering.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/DoubleBuffering/master/DoubleBuffering.lua",
fileID=97,
},
{
path="/lib/GUI.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/GUI/master/GUI.lua",
fileID=100,
},
{
path="/lib/MineOSCore.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/MineOSCore.lua",
fileID=108,
},
{
path="/lib/MineOSPaths.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSPaths.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/MineOSPaths.lua",
fileID=110,
},
{
path="/lib/web.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/web.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/web.lua",
fileID=101,
},
},
localizations = {
{
path="/MineOS/System/Localizations/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localizations/OS/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Localizations/OS/English.lang",
fileID=554,
},
{
path="/MineOS/System/Localizations/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localizations/OS/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Localizations/OS/French.lang",
fileID=848,
},
{
path="/MineOS/System/Localizations/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localizations/OS/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Localizations/OS/Russian.lang",
fileID=553,
},
},
@ -66,357 +66,357 @@
-- Либы
{
path="/lib/MineOSNetwork.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSNetwork.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/MineOSNetwork.lua",
fileID=253,
},
{
path="/lib/MineOSInterface.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSInterface.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/MineOSInterface.lua",
fileID=109,
},
{
path="/lib/event.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/event.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/event.lua",
fileID=102,
},
{
path="/lib/FormatModules/OCAF.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/FormatModules/OCAF.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/FormatModules/OCAF.lua",
},
{
path="/lib/archive.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/archive.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/archive.lua",
fileID=94,
},
{
path="/lib/SHA2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/SHA2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/SHA2.lua",
fileID=104,
},
{
path="/lib/ECSAPI.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/lib/ECSAPI.lua",
fileID=252,
},
-- Скрипты
{
path="/bin/OS.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/OS.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/OS.lua",
fileID=106,
},
-- Ассоциации контекстного меню
{
path="/MineOS/System/Extensions/Lua/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Extensions/Lua/ContextMenu.lua",
fileID=150,
},
{
path="/MineOS/System/Extensions/Lua/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Extensions/Lua/Launcher.lua",
fileID=151,
},
{
path="/MineOS/System/Extensions/Pic/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Pic/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Extensions/Pic/ContextMenu.lua",
fileID=152,
},
{
path="/MineOS/System/Extensions/Arc/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Arc/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Extensions/Arc/Launcher.lua",
fileID=153,
},
-- Системные иконки
{
path="/MineOS/System/Icons/Application.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Application.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Application.pic",
fileID=131,
},
{
path="/MineOS/System/Icons/3DModel.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/3DModel.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/3DModel.pic",
fileID=132,
},
{
path="/MineOS/System/Icons/Computer.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Computer.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Computer.pic",
fileID=133,
},
{
path="/MineOS/System/Icons/Robot.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Robot.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Robot.pic",
fileID=134,
},
{
path="/MineOS/System/Icons/Tablet.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Tablet.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Tablet.pic",
fileID=135,
},
{
path="/MineOS/System/Icons/Pastebin.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Pastebin.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Pastebin.pic",
fileID=136,
},
{
path="/MineOS/System/Icons/HDD.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/HDD.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/HDD.pic",
fileID=137,
},
{
path="/MineOS/System/Icons/Floppy.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Floppy.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Floppy.pic",
fileID=138,
},
{
path="/MineOS/System/Icons/Steve.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Steve.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Steve.pic",
fileID=139,
},
{
path="/MineOS/System/Icons/Folder.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Folder.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Folder.pic",
fileID=140,
},
{
path="/MineOS/System/Icons/FileNotExists.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/FileNotExists.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/FileNotExists.pic",
fileID=141,
},
{
path="/MineOS/System/Icons/Script.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Script.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Script.pic",
fileID=142,
},
{
path="/MineOS/System/Icons/Text.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Text.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Text.pic",
fileID=143,
},
{
path="/MineOS/System/Icons/Config.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Config.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Config.pic",
fileID=144,
},
{
path="/MineOS/System/Icons/Image.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Image.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Image.pic",
fileID=145,
},
{
path="/MineOS/System/Icons/Lua.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Lua.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Lua.pic",
fileID=146,
},
{
path="/MineOS/System/Icons/SampleIcon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/SampleIcon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/SampleIcon.pic",
fileID=147,
},
{
path="/MineOS/System/Icons/Archive.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Archive.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Archive.pic",
fileID=148,
},
{
path="/MineOS/System/Icons/Trash.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Trash.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Icons/Trash.pic",
fileID=149,
},
-- Скринсейверы
{
path="/MineOS/System/Screensavers/Matrix.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Matrix.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/Matrix.lua",
},
{
path="/MineOS/System/Screensavers/Mandala.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Mandala.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/Mandala.lua",
},
{
path="/MineOS/System/Screensavers/Clock.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Clock.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/Clock.lua",
},
{
path="/MineOS/System/Screensavers/Lines.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Lines.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/Lines.lua",
},
{
path="/MineOS/System/Screensavers/XCOM.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/XCOM.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/XCOM.lua",
},
{
path="/MineOS/System/Screensavers/NyanCat.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/NyanCat.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Screensavers/NyanCat.lua",
},
-- Приложения
{
path="/MineOS/Applications/App Market.app/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/AppMarket/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/AppMarket/Main.lua",
fileID=164,
},
{
path="/MineOS/Applications/App Market.app/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/AppMarket/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/AppMarket/Icon.pic",
},
{
path="/MineOS/Applications/App Market.app/Localizations/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/AppMarket/Localization/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/AppMarket/Localization/Russian.lang",
},
{
path="/MineOS/Applications/App Market.app/Localizations/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/AppMarket/Localization/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/AppMarket/Localization/English.lang",
},
{
path="/MineOS/Applications/App Market.app/Localizations/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/AppMarket/Localization/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/AppMarket/Localization/French.lang",
},
--
{
path="/MineOS/Applications/MineCode IDE.app/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/MineCodeIDE/Main.lua",
fileID=169,
},
{
path="/MineOS/Applications/MineCode IDE.app/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/MineCodeIDE/Icon.pic",
},
{
path="/MineOS/Applications/MineCode IDE.app/Localizations/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Localization/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/MineCodeIDE/Localization/Russian.lang",
},
{
path="/MineOS/Applications/MineCode IDE.app/Localizations/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Localization/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/MineCodeIDE/Localization/English.lang",
},
{
path="/MineOS/Applications/MineCode IDE.app/Localizations/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Localization/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/MineCodeIDE/Localization/French.lang",
},
--
{
path="/MineOS/Applications/Picture Edit.app/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Main.lua",
fileID=798,
},
{
path="/MineOS/Applications/Picture Edit.app/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Icon.pic",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/1.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/1.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/1.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/2.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/3.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/3.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/3.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/4.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/4.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/4.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/5.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/5.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/5.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/6.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/6.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/6.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/7.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/7.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/7.lua",
},
{
path="/MineOS/Applications/Picture Edit.app/Tools/8.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/PictureEdit/Tools/8.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/PictureEdit/Tools/8.lua",
},
--
{
path="/MineOS/Applications/Control.app/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Main.lua",
fileID=292,
},
{
path="/MineOS/Applications/Control.app/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Icon.pic",
},
{
path="/MineOS/Applications/Control.app/Localizations/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Localization/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Localization/Russian.lang",
},
{
path="/MineOS/Applications/Control.app/Localizations/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Localization/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Localization/English.lang",
},
{
path="/MineOS/Applications/Control.app/Localizations/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Localization/French.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Localization/French.lang",
},
{
path="/MineOS/Applications/Control.app/Modules/1.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Modules/1.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Modules/1.lua",
},
{
path="/MineOS/Applications/Control.app/Modules/2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Modules/2.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Modules/2.lua",
},
{
path="/MineOS/Applications/Control.app/Modules/3.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Modules/3.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Modules/3.lua",
},
{
path="/MineOS/Applications/Control.app/Modules/4.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Control/Modules/4.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Control/Modules/4.lua",
},
--
{
path="/MineOS/Applications/Finder.app/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Finder/Main.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Finder/Main.lua",
fileID=175,
},
{
path="/MineOS/Applications/Finder.app/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/Finder/Icon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Applications/Finder/Icon.pic",
},
},
wallpapers = {
{
path="/MineOS/Pictures/MoonTouch.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/MoonTouch.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/MoonTouch.pic",
},
{
path="/MineOS/Pictures/Raspberry.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Raspberry.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Raspberry.pic",
},
{
path="/MineOS/Pictures/Catniss.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Catniss.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Catniss.pic",
},
{
path="/MineOS/Pictures/Ciri.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Ciri.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Ciri.pic",
},
{
path="/MineOS/Pictures/Girl.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Girl.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Girl.pic",
},
{
path="/MineOS/Pictures/Space.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Space.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Space.pic",
},
{
path="/MineOS/Pictures/Block.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Block.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Block.pic",
},
{
path="/MineOS/Pictures/Road.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Road.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/Road.pic",
},
{
path="/MineOS/Pictures/TyanSunset.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/TyanSunset.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Wallpapers/TyanSunset.pic",
},
}
}

View File

@ -1,8 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" name="ImageConverter:jar">
<output-path>$PROJECT_DIR$/out/artifacts/ImageConverter_jar</output-path>
<root id="archive" name="ImageConverter.jar">
<element id="module-output" name="ImageConverter" />
</root>
</artifact>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,2 +0,0 @@
<html>Simple <b>JavaFX 2.0</b> application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
</html>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="gradleHome" value="C:/Program Files (x86)/Gradle/gradle-1.0-rc-3" />
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinCommonCompilerArguments">
<option name="languageVersion" value="1.1" />
<option name="apiVersion" value="1.1" />
</component>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectKey">
<option name="state" value="project://e79810c8-c5c8-43b1-b19c-90c1f4095425" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ImageConverter.iml" filepath="$PROJECT_DIR$/ImageConverter.iml" />
</modules>
</component>
</project>

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

View File

@ -1,967 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="ImageConverter:jar" />
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="cdb932d9-7e58-4d94-93a9-e7b232ef17da" name="Default" comment="" />
<ignored path="JavaFxApplication.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DebuggerManager">
<breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true" converted="true">
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="SUSPEND" value="true" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="true" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="SUSPEND" value="true" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="true" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
</breakpoint_any>
<ui_properties converted="true" />
<breakpoint_rules converted="true" />
</component>
<component name="FavoritesManager">
<favorites_list name="JavaFxApplication" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="OCIF.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="15" column="5" lean-forward="false" selection-start-line="15" selection-start-column="5" selection-end-line="15" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="275" column="16" lean-forward="true" selection-start-line="275" selection-start-column="16" selection-end-line="275" selection-end-column="16" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5213#5602#0" expanded="true" />
<element signature="e#5601#5602#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Image.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2921">
<caret line="128" column="51" lean-forward="false" selection-start-line="128" selection-start-column="51" selection-end-line="128" selection-end-column="51" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Singleton" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>open</find>
<find>ocif</find>
<find>onTextFieldTextChanged</find>
<find>initi</find>
<find>OCIF6</find>
<find>OCIF5ConvertAsBraille</find>
<find>OCIF5ConvertAsSemiPixel</find>
<find>mainPane</find>
<find>play</find>
<find>playAnimation(</find>
<find>initiali</find>
<find>loadIm</find>
<find>encodingMethods</find>
<find>combo</find>
<find>результ</find>
<find>enable bra</find>
<find>scene</find>
<find>integerToByteArray</find>
<find>currentImagePath</find>
<find>new Image</find>
<find>imageGridPan</find>
<find>loadImage</find>
<find>dragEn</find>
<find>playAnimationSt</find>
<find>hints</find>
<find>OCIF</find>
<find>loadImage(</find>
<find>onDithering</find>
<find>new</find>
<find>percen</find>
</findStrings>
<replaceStrings>
<replace>sample</replace>
<replace>dragDropAnimationGridPane</replace>
</replaceStrings>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/sample/Pixel.java" />
<option value="$PROJECT_DIR$/src/sample/ImageConverter.fxml" />
<option value="$PROJECT_DIR$/src/sample/Palette.java" />
<option value="$PROJECT_DIR$/src/sample/Styles/textFieldOCIFString.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringTextField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/Cells.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/textField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/button.css" />
<option value="$PROJECT_DIR$/src/sample/Color.java" />
<option value="$PROJECT_DIR$/src/sample/Image.java" />
<option value="$PROJECT_DIR$/src/sample/OCIF.java" />
<option value="$PROJECT_DIR$/src/sample/Main.java" />
</list>
</option>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="y" value="23" />
<option name="width" value="1920" />
<option name="height" value="973" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="ImageConverter" type="b2602c69:ProjectViewProjectNode" />
<item name="ImageConverter" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ImageConverter" type="b2602c69:ProjectViewProjectNode" />
<item name="ImageConverter" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ImageConverter" type="b2602c69:ProjectViewProjectNode" />
<item name="ImageConverter" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="sample" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ImageConverter" type="b2602c69:ProjectViewProjectNode" />
<item name="ImageConverter" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="sample" type="462c0819:PsiDirectoryNode" />
<item name="Resources" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ImageConverter" type="b2602c69:ProjectViewProjectNode" />
<item name="ImageConverter" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="sample" type="462c0819:PsiDirectoryNode" />
<item name="Styles" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="OverrideImplement.combined" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="recentsLimit" value="5" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="dynamic.classpath" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.Language Defaults" />
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="imageconverter" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/sample/Styles" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<module />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
</configuration>
<configuration name="Main" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
<pattern>
<option name="PATTERN" value="sample.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="MAIN_CLASS_NAME" value="sample.Main" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="ImageConverter" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<envs />
</configuration>
<configuration default="true" type="Java Scratch" factoryName="Java Scratch">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="SCRATCH_FILE_ID" value="0" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="ImageConverter" />
<envs />
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<envs />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="ENABLE_ADVANCED_PROFILING" value="true" />
<option name="GAPID_ENABLED" value="false" />
<option name="GAPID_DISABLE_PCS" value="false" />
<option name="SUPPORT_LIB_ENABLED" value="true" />
<option name="INSTRUMENTATION_ENABLED" value="true" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="ENABLE_ADVANCED_PROFILING" value="true" />
<option name="GAPID_ENABLED" value="false" />
<option name="GAPID_DISABLE_PCS" value="false" />
<option name="SUPPORT_LIB_ENABLED" value="true" />
<option name="INSTRUMENTATION_ENABLED" value="true" />
</Profilers>
<method />
</configuration>
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
<method />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="cdb932d9-7e58-4d94-93a9-e7b232ef17da" name="Default" comment="" />
<created>1359379246138</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1359379246138</updated>
<workItem from="1359379250712" duration="1302000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="1302000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="973" extended-state="0" />
<layout>
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15572916" sideWeight="0.6703755" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3289183" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.20754717" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Profiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="JetGradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Problems" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="11" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1635">
<caret line="113" column="14" lean-forward="false" selection-start-line="113" selection-start-column="14" selection-end-line="113" selection-end-column="14" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="13" lean-forward="false" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="31" lean-forward="false" selection-start-line="7" selection-start-column="31" selection-end-line="7" selection-end-column="31" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3240">
<caret line="217" column="27" lean-forward="true" selection-start-line="217" selection-start-column="27" selection-end-line="217" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5213#5602#0" expanded="true" />
<element signature="e#5601#5602#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Pixel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="18" lean-forward="false" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1875">
<caret line="129" column="28" lean-forward="true" selection-start-line="129" selection-start-column="28" selection-end-line="129" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="13" lean-forward="false" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2445">
<caret line="164" column="16" lean-forward="false" selection-start-line="164" selection-start-column="16" selection-end-line="164" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="31" lean-forward="false" selection-start-line="7" selection-start-column="31" selection-end-line="7" selection-end-column="31" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5213#5602#0" expanded="true" />
<element signature="e#5601#5602#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Pixel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="18" lean-forward="false" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="47" lean-forward="false" selection-start-line="10" selection-start-column="24" selection-end-line="10" selection-end-column="47" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="13" lean-forward="false" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2460">
<caret line="164" column="16" lean-forward="false" selection-start-line="164" selection-start-column="16" selection-end-line="164" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5213#5602#0" expanded="true" />
<element signature="e#5601#5602#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/sample.fxml" />
<entry file="file://$PROJECT_DIR$/src/sample/Controller.java" />
<entry file="file://$PROJECT_DIR$/src/sample/Controller.java" />
<entry file="file://$PROJECT_DIR$/src/sample/sample.fxml" />
<entry file="file://$PROJECT_DIR$/src/sample/test.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/com/sun/javafx/event/EventHandlerManager.java" />
<entry file="file://$PROJECT_DIR$/src/sample/Resources/Background2.png" />
<entry file="file://$PROJECT_DIR$/src/sample/Resources/Background.jpg" />
<entry file="file://$USER_HOME$/Desktop/IMG_2279.JPG" />
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1905">
<caret line="127" column="23" lean-forward="false" selection-start-line="127" selection-start-column="23" selection-end-line="127" selection-end-column="23" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/util/HashMap.java" />
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="0" lean-forward="true" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
<folding>
<element signature="e#3645#3646#0" expanded="false" />
<element signature="e#3700#3701#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Pixel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="8" lean-forward="true" selection-start-line="10" selection-start-column="8" selection-end-line="13" selection-end-column="29" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Resources/StringResultButtonPressed.png" />
<entry file="file://$PROJECT_DIR$/src/sample/Styles/checkBox.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/text.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/OCIFStringTextField.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="84" lean-forward="false" selection-start-line="13" selection-start-column="84" selection-end-line="13" selection-end-column="84" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Resources/StringResultButton.psd">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="69" lean-forward="true" selection-start-line="8" selection-start-column="26" selection-end-line="8" selection-end-column="69" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/Cells.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="0" lean-forward="true" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/javafx/scene/input/MouseEvent.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/javafx/scene/layout/Region.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/javafx/stage/Window.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/lang/StrictMath.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/lang/Math.java" />
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="299">
<caret line="53" column="31" lean-forward="false" selection-start-line="53" selection-start-column="24" selection-end-line="53" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/button.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="0" lean-forward="false" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/comboBox.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="810">
<caret line="54" column="0" lean-forward="false" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/textField.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="35" lean-forward="false" selection-start-line="18" selection-start-column="35" selection-end-line="18" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="15" column="5" lean-forward="false" selection-start-line="15" selection-start-column="5" selection-end-line="15" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2921">
<caret line="128" column="51" lean-forward="false" selection-start-line="128" selection-start-column="51" selection-end-line="128" selection-end-column="51" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="275" column="16" lean-forward="true" selection-start-line="275" selection-start-column="16" selection-end-line="275" selection-end-column="16" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5213#5602#0" expanded="true" />
<element signature="e#5601#5602#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<last-edited>ImageConverter:jar</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.5" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>ImageConverter</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,5 +0,0 @@
![Imgur](https://i.imgur.com/ZSgoRYY.png)
Крч, это пиздатый конвертер с поддержкой дизеринга и шрифта Брайля, так что пикчи в твоей майновской хате будут настолько графонистыми, что Ваномас лично позволит пробить ему анальти. Приятного использования, йоба, я старался

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: sample.Main

View File

@ -1,221 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.*?>
<?import java.net.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.collections.*?>
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="606.0" prefWidth="1149.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane>
<children>
<ImageView fx:id="imageView" fitHeight="805.0" fitWidth="1149.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Background.png" />
</image>
<effect>
<DropShadow color="#000000a0" height="41.655" offsetY="4.0" radius="20.896250000000002" width="43.93" />
</effect>
</ImageView>
</children>
</Pane>
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000CC;" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane fx:id="dragImageGridPane">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="dragDropFilesImageView" fitWidth="180.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Files.png" />
</image>
</ImageView>
</children>
</GridPane>
<GridPane fx:id="OCIFStringResutGridPane" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="OCIFStringResultImageView" fitHeight="150.0" fitWidth="369.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/StringResult.png" />
</image>
</ImageView>
<GridPane fx:id="OCIFStringResultGridPane" maxHeight="38.0" maxWidth="312.0" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="-Infinity" prefWidth="38.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<TextField fx:id="OCIFStringResultTextField" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" promptText="Ширина" styleClass="textField" stylesheets="@Styles/OCIFStringTextField.css" text="FFAABBCCAAFFAAFFRRAAVVAAA" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<font>
<Font size="12.0" />
</font>
<GridPane.margin>
<Insets right="8.0" />
</GridPane.margin>
</TextField>
<Button fx:id="OCIFStringResultButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#copyOCIFResultToClipboard" styleClass="defaultButton" stylesheets="@Styles/OCIFStringButton.css" GridPane.columnIndex="1" />
</children>
</GridPane>
</children>
</GridPane>
</children>
</GridPane>
<GridPane fx:id="settingsPane" maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minWidth="0.0" prefWidth="250.0" style="-fx-background-color: #000000D0;" GridPane.halignment="RIGHT" GridPane.valignment="TOP">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="45.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<VBox>
<children>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" prefHeight="20.0" prefWidth="250.0" text="OC Image Converter" textFill="WHITE">
<font>
<Font name="Arial" size="16.0" />
</font>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Label>
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<font>
<Font size="11.0" />
</font>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
<Label fx:id="imageSizeInfoLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="N/A" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
</TextField>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Format" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
<ComboBox fx:id="encodingMethodComboBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onAction="#onTextFieldTextChanged" prefHeight="38.0" stylesheets="@Styles/comboBox.css">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="OCIFString" />
<String fx:value="OCIF5 (Multiscreen)" />
<String fx:value="OCIF6 (Optimized)" />
</FXCollections>
</items>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</ComboBox>
<CheckBox fx:id="keepProportionsCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onProportionsCheckBoxClicked" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Keep proportions" textFill="WHITE">
<VBox.margin>
<Insets left="10.0" top="15.0" />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="brailleCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable Braille font" textFill="WHITE">
<VBox.margin>
<Insets left="10.0" top="12.0" />
</VBox.margin>
</CheckBox>
<GridPane fx:id="ditheringMainPane" prefHeight="120.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane fx:id="ditheringBackgroundPane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: FFFFFF10;">
<children>
<Label fx:id="ditheringOpacityLabel" alignment="CENTER" layoutY="45.0" minHeight="0.0" prefWidth="250.0" text="Opacity" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<Slider fx:id="ditheringOpacitySlider" layoutY="65.0" minHeight="0.0" prefWidth="250.0" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</Slider>
</children></Pane>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<GridPane.margin>
<Insets left="10.0" top="6.0" />
</GridPane.margin>
</CheckBox>
</children>
<VBox.margin>
<Insets top="6.0" />
</VBox.margin>
</GridPane>
</children>
</VBox>
<Button fx:id="convertButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#save" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Convert" GridPane.rowIndex="1">
<font>
<Font size="11.0" />
</font>
</Button>
</children>
<GridPane.margin>
<Insets />
</GridPane.margin>
</GridPane>
</children>
</GridPane>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,7 +0,0 @@
.cyka {
-fx-background-image: url("../Resources/Cells.png");
}

View File

@ -1,21 +0,0 @@
.defaultButton {
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-background-color: #FFFFFF20;
-fx-background-image: url("../Resources/StringResultDefault.png");
}
.defaultButton:hover {
-fx-effect: dropshadow(three-pass-box, rgba(255, 255, 255, 0.6), 10, 0.2, 0, 1);
}
.defaultButton:pressed {
-fx-effect: dropshadow(three-pass-box, rgba(255, 255, 255, 0.6), 10, 0.2, 0, 1);
-fx-background-image: url("../Resources/StringResultPressed.png");
}

View File

@ -1,15 +0,0 @@
.textField {
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-text-fill: #000;
-fx-background-color: #FFF;
-fx-accent: #888;
}
.textField:hover {
-fx-effect: dropshadow(three-pass-box, rgba(255, 255, 255, 0.6), 10, 0.2, 0, 1);
}

View File

@ -1,25 +0,0 @@
.defaultButton {
-fx-background-color: #FFFFFF10;
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-font-size: 10pt;
-fx-text-fill: #FFFFFF88;
}
.defaultButton:hover {
-fx-text-fill: #000000;
-fx-background-color: #FFFFFF;
-fx-effect: dropshadow(three-pass-box, rgba(255, 255, 255, 0.6), 10, 0.2, 0, 1);
}
.defaultButton:disabled {
-fx-background-color: #FFFFFF15;
-fx-text-fill: #FFFFFF77;
}

View File

@ -1,62 +0,0 @@
.check-box {
-fx-skin: "com.sun.javafx.scene.control.skin.CheckBoxSkin";
-fx-label-padding: 0.0em 0.0em 0.0em 0.616667em; /* 0 0 0 5 */
-fx-text-fill: #FFFFFF88;
-fx-font-size: 15pt;
}
.check-box:focused {
-fx-color: -fx-focused-base;
}
.check-box .text {
-fx-text-fill: -fx-text-background-color;
-fx-font-family: "Graphon", Arial;
-fx-font-size: 9pt;
}
.check-box .box {
-fx-background-color: #FFFFFF10;
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-background-radius: 2, 2, 1, 1;
-fx-padding: 0.25em; /* 3 -- padding from the outside edge to the mark */
}
.check-box:hover {
/*-fx-color: -fx-hover-base;*/
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.6) , 10, 0.2 , 0 , 1 );
-fx-text-fill: #FFFFFF;
}
.check-box:armed .box {
-fx-color: -fx-pressed-base;
}
.check-box .mark {
-fx-background-color: transparent;
-fx-background-insets: 1 0 -1 0, 0;
-fx-padding: 0.333333em; /* 4 -- this is half the size of the mark */
-fx-shape: "M0,4H2L3,6L6,0H8L4,8H2Z";
}
/* TODO: scale the shape - the problem is that it is not within a square
* boundary.
*/
.check-box:indeterminate .mark {
-fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
-fx-shape: "M0,0H8V2H0Z";
-fx-scale-shape: false;
}
.check-box:selected .mark {
-fx-background-color: #FFFFFF;
}
.check-box:disabled {
-fx-opacity: -fx-disabled-opacity;
}
.check-box:show-mnemonics .mnemonic-underline {
-fx-stroke: -fx-text-fill;
}

View File

@ -1,69 +0,0 @@
.combo-box
{
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-background-insets: 0, 0;
-fx-background-color: #FFFFFF10;
}
.combo-box:hover
{
-fx-background-color: #FFFFFF;
-fx-text-fill: #000000;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.6) , 10, 0.2 , 0 , 1 );
}
.arrow {
-fx-background-color: #FFFFFF;
}
.combo-box:hover .arrow
{
-fx-background-color: #000000;
}
.arrow-button {
-fx-background-radius: 0;
-fx-background-color: #FFFFFF0A;
}
.combo-box:hover .arrow-button {
-fx-background-color: #E0E0E0;
}
.list-view
{
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-background-insets: 0;
-fx-padding: 0;
-fx-background-color: #FFFFFF88;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.6) , 10, 0.2 , 0 , 1 );
}
.list-cell
{
-fx-pref-height: 38;
-fx-background-color: #FFFFFF00;
-fx-text-fill: #000000;
}
.list-cell:selected
{
-fx-background-color: #FFFFFF00;
-fx-text-fill: #AAAAAA;
}
.combo-box:hover .list-cell:selected
{
-fx-background-color: #FFFFFF00;
-fx-text-fill: #000000;
}
.list-cell:hover
{
-fx-background-color: #FFFFFF;
-fx-text-fill: #000000;
}

View File

@ -1,14 +0,0 @@
.progressBar {
-fx-background-color: #FFFFFF10;
-fx-border-radius: 0;
-fx-background-radius: 0;
}
.progressBar:hover {
-fx-text-fill: #000000;
-fx-background-color: #FFFFFF;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.6) , 10, 0.2 , 0 , 1 );
}

View File

@ -1,58 +0,0 @@
.slider {
-fx-skin: "com.sun.javafx.scene.control.skin.SliderSkin";
}
.slider .thumb {
-fx-background-color: #FFFFFF;
/*derive(-fx-color,-36%),
derive(-fx-color,73%),
linear-gradient(to bottom, derive(-fx-color,-19%),derive(-fx-color,61%));*/
-fx-background-insets: 0, 1, 2;
-fx-background-radius: 1.0em;
-fx-padding: 0.6em;
}
.slider .track {
-fx-background-color: #FFFFFF15;
-fx-background-insets: 1 0 -1 0, 0, 1;
-fx-background-radius: 2.5, 2.5, 1.5;
-fx-padding: 0.208333em; /* 2.5 */
}
.slider .axis {
-fx-tick-label-font: 0.833333em System;
-fx-tick-label-fill: #FFFFFF88;
}
.axis-tick-mark {
-fx-stroke: #FFFFFF15;
}
.axis-minor-tick-mark {
-fx-stroke: #FFFFFF15;
}
.slider:hover .axis-tick-mark {
-fx-stroke: #FFFFFF20;
}
.slider:hover .axis-minor-tick-mark {
-fx-stroke: #FFFFFF20;
}
.slider:hover .axis {
-fx-tick-label-fill: #FFFFFFAA;
}
.slider:hover {
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.6) , 10, 0.2 , 0 , 1 );
}
.slider:hover .thumb {
-fx-background-insets: -1.5, 0, 1, 2;
-fx-background-radius: 1.0em;
}
.slider:disabled {
-fx-opacity: 0.5;
}

View File

@ -1,9 +0,0 @@
.text {
-fx-font-family: "Graphon", Arial, sans-serif;
-fx-font-size: 10pt;
-fx-text-fill: #FFFFFF;
}

View File

@ -1,21 +0,0 @@
.textField {
-fx-background-color: #FFFFFF10;
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-font-size: 10pt;
-fx-text-fill: #FFFFFF88;
-fx-accent: #888;
}
.textField:hover {
-fx-text-fill: #000;
-fx-background-color: #FFF;
-fx-effect: dropshadow(three-pass-box, rgba(255, 255, 255, 0.6), 10, 0.2, 0, 1);
}
.textField:disabled {
-fx-background-color: #FFFFFF10;
-fx-text-fill: #FFFFFF77;
}

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: sample.Main

View File

@ -1,72 +0,0 @@
package sample;
public class Color {
int alpha;
int red;
int green;
int blue;
public Color(int argb) {
this.alpha = 0xFF - (argb >> 24) & 0xFF;
this.red = (argb >> 16) & 0xFF;
this.green = (argb >> 8) & 0xFF;
this.blue = argb & 0xFF;
}
public Color(int alpha, int red, int green, int blue) {
this.alpha = alpha;
this.red = red;
this.green = green;
this.blue = blue;
}
public int toArgb()
{
return (this.alpha << 24) | ((this.red << 16) | ((this.green << 8) | this.blue));
}
public static Color difference(Color color1, Color color2)
{
return new Color(
color1.alpha - color2.alpha,
color1.red - color2.red,
color1.green - color2.green,
color1.blue - color2.blue
);
}
public static Color sum(Color color1, Color color2)
{
int aSum = color1.alpha + color2.alpha;
int rSum = color1.red + color2.red;
int gSum = color1.green + color2.green;
int bSum = color1.blue + color2.blue;
if (aSum > 255) aSum = 255;
if (rSum > 255) rSum = 255;
if (gSum > 255) gSum = 255;
if (bSum > 255) bSum = 255;
return new Color(aSum, rSum, gSum, bSum);
}
public static Color average(Color color1, Color color2) {
return new Color(
(color1.alpha + color2.alpha) / 2,
(color1.red + color2.red) / 2,
(color1.green + color2.green) / 2,
(color1.blue + color2.blue) / 2
);
}
public static Color multiply(Color color, double multiplyer)
{
return new Color(
(int) (color.alpha * multiplyer),
(int) (color.red * multiplyer),
(int) (color.green * multiplyer),
(int) (color.blue * multiplyer)
);
}
}

View File

@ -1,289 +0,0 @@
package sample;
import java.util.ArrayList;
import java.util.HashMap;
public class Image {
public int width;
public int height;
public Color[][] pixels;
public Image(javafx.scene.image.Image image) {
this.width = (int) image.getWidth();
this.height = (int) image.getHeight();
this.pixels = new Color[this.height][this.width];
for (int y = 0; y < this.height; y++) {
for (int x = 0; x < this.width; x++) {
this.pixels[y][x] = new Color(image.getPixelReader().getArgb(x, y));
}
}
}
private static String getBrailleChar(int a, int b, int c, int d, int e, int f, int g, int h) {
return Character.toString((char) (10240 + 128 * h + 64 * g + 32 * f + 16 * d + 8 * b + 4 * e + 2 * c + a));
}
private static Color[][] getBraiileArray(Image image, int fromX, int fromY) {
Color[][] brailleArray = new Color[4][2];
int imageX, imageY;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 2; x++) {
imageX = fromX + x;
imageY = fromY + y;
if (imageX < image.width && imageY < image.height) {
brailleArray[y][x] = image.pixels[imageY][imageX];
} else {
brailleArray[y][x] = new Color(0x00000000);
}
}
}
return brailleArray;
}
private static double getColorDistance(Color myColor) {
return Math.pow((double) myColor.red, 2) + Math.pow((double) myColor.green, 2) + Math.pow((double) myColor.blue, 2);
}
private static double getChannelsDelta(Color color1, Color color2) {
return Math.pow((double) color1.red - color2.red, 2) + Math.pow((double) color1.green - color2.green, 2) + Math.pow((double) color1.blue - color2.blue, 2);
}
private static Color getBestMatch(Color color1, Color color2, Color targetColor) {
return getChannelsDelta(color1, targetColor) < getChannelsDelta(color2, targetColor) ? color1 : color2;
}
static Pixel getBraillePixel(Image image, int fromX, int fromY) {
Color[][] brailleArray = getBraiileArray(image, fromX, fromY);
double distance, minDistance = 999999.0d, maxDistance = 0.0d;
Color minColor = brailleArray[0][0], maxColor = brailleArray[0][0];
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 2; x++) {
distance = getColorDistance(brailleArray[y][x]);
if (distance < minDistance) {
minDistance = distance;
minColor = brailleArray[y][x];
}
if (distance > maxDistance) {
maxDistance = distance;
maxColor = brailleArray[y][x];
}
}
}
int[][] brailleMatrix = new int[4][2];
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 2; x++) {
brailleMatrix[y][x] = getBestMatch(minColor, maxColor, brailleArray[y][x]) == minColor ? 0 : 1;
}
}
String brailleChar = getBrailleChar(
brailleMatrix[0][0], brailleMatrix[0][1],
brailleMatrix[1][0], brailleMatrix[1][1],
brailleMatrix[2][0], brailleMatrix[2][1],
brailleMatrix[3][0], brailleMatrix[3][1]
);
return new Pixel(minColor, maxColor, 0x00, brailleChar);
}
private static final double Xp1Yp0 = 7.0d / 16.0d;
private static final double Xp1Yp1 = 1.0d / 16.0d;
private static final double Xp0Yp1 = 5.0d / 16.0d;
private static final double Xm1Y1 = 3.0d / 16.0d;
static Image dither(Image image, double intensity) {
for (int y = 0; y < image.height; y++) {
for (int x = 0; x < image.width; x++) {
Color paletteColor = Palette.getClosestColor(image.pixels[y][x]);
Color colorDifference = Color.difference(image.pixels[y][x], paletteColor);
image.pixels[y][x] = paletteColor;
if (x < image.width - 1) {
image.pixels[y][x + 1] = Color.sum(
image.pixels[y][x + 1],
Color.multiply(colorDifference, Xp1Yp0 * intensity)
);
if (y < image.height - 1) {
image.pixels[y + 1][x + 1] = Color.sum(
image.pixels[y + 1][x + 1],
Color.multiply(colorDifference, Xp1Yp1 * intensity)
);
}
}
if (y < image.height - 1) {
image.pixels[y + 1][x] = Color.sum(
image.pixels[y + 1][x],
Color.multiply(colorDifference, Xp0Yp1 * intensity)
);
if (x > 0) {
image.pixels[y + 1][x - 1] = Color.sum(
image.pixels[y + 1][x - 1],
Color.multiply(colorDifference, Xm1Y1 * intensity)
);
}
}
}
}
return image;
}
static Pixel getSemiPixel(Image image, int x, int y) {
Color upper = image.pixels[y][x], lower = new Color(0xFF, 0x0, 0x0, 0x0);
if (y < image.height) {
lower = image.pixels[y + 1][x];
}
Pixel pixel = new Pixel(upper, lower, 0x00, "");
if (upper.alpha == 0x00) {
//Есть и наверху, и внизу
if (lower.alpha == 0x00) {
pixel.background = upper;
pixel.foreground = lower;
pixel.alpha = 0x00;
pixel.symbol = "";
}
//Есть только наверху, внизу прозрачный
else {
pixel.background = upper;
pixel.foreground = upper;
pixel.alpha = 0xFF;
pixel.symbol = "";
}
} else {
//Нет наверху, но есть внизу
if (lower.alpha == 0x00) {
pixel.background = upper;
pixel.foreground = lower;
pixel.alpha = 0xFF;
pixel.symbol = "";
}
//Нет ни наверху, ни внизу
else {
pixel.background = upper;
pixel.foreground = lower;
pixel.alpha = 0xFF;
pixel.symbol = " ";
}
}
return pixel;
}
private static HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> fillHashMap(Integer alpha, String symbol, Integer background, Integer foreground, Integer y, Integer x) {
ArrayList<Integer> xs = new ArrayList<>();
HashMap<Integer, ArrayList<Integer>> ys = new HashMap<>();
ys.put(y, xs);
HashMap<Integer, HashMap<Integer, ArrayList<Integer>>> fs = new HashMap<>();
fs.put(foreground, ys);
HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>> bs = new HashMap<>();
bs.put(background, fs);
HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>> ss = new HashMap<>();
ss.put(symbol, bs);
HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> as = new HashMap<>();
as.put(alpha, ss);
return as;
}
private static void groupPixel(HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupedImage, Integer alpha, String symbol, Integer background, Integer foreground, Integer y, Integer x) {
HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> filledHashMap = fillHashMap(alpha, symbol, background, foreground, y, x);
if (!groupedImage.containsKey(alpha)) {
groupedImage.put(
alpha,
filledHashMap.get(alpha)
);
}
if (!groupedImage.get(alpha).containsKey(symbol)) {
groupedImage.get(alpha).put(
symbol,
filledHashMap.get(alpha).get(symbol)
);
}
if (!groupedImage.get(alpha).get(symbol).containsKey(background)) {
groupedImage.get(alpha).get(symbol).put(
background,
filledHashMap.get(alpha).get(symbol).get(background)
);
}
if (!groupedImage.get(alpha).get(symbol).get(background).containsKey(foreground)) {
groupedImage.get(alpha).get(symbol).get(background).put(
foreground,
filledHashMap.get(alpha).get(symbol).get(background).get(foreground)
);
}
if (!groupedImage.get(alpha).get(symbol).get(background).get(foreground).containsKey(y)) {
groupedImage.get(alpha).get(symbol).get(background).get(foreground).put(
y,
filledHashMap.get(alpha).get(symbol).get(background).get(foreground).get(y)
);
}
groupedImage.get(alpha).get(symbol).get(background).get(foreground).get(y).add(x);
}
static HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupAsBraille(Image image) {
HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupedImage = new HashMap<>();
Pixel pixel;
int xCounter = 1, yCounter = 1;
for (int y = 0; y < image.height; y += 4) {
for (int x = 0; x < image.width; x += 2) {
pixel = getBraillePixel(image, x, y);
groupPixel(groupedImage, pixel.alpha, pixel.symbol, Palette.getClosestIndex(pixel.background), Palette.getClosestIndex(pixel.foreground), yCounter, xCounter);
xCounter++;
}
xCounter = 1;
yCounter++;
}
return groupedImage;
}
static HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupAsSemiPixel(Image image) {
HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupedImage = new HashMap<>();
Pixel pixel;
int yCounter = 1;
for (int y = 0; y < image.height; y += 2) {
for (int x = 0; x < image.width; x++) {
pixel = getSemiPixel(image, x, y);
groupPixel(groupedImage, pixel.alpha, pixel.symbol, Palette.getClosestIndex(pixel.background), Palette.getClosestIndex(pixel.foreground), yCounter, x + 1);
}
yCounter++;
}
return groupedImage;
}
}

View File

@ -1,221 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.*?>
<?import java.net.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.collections.*?>
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="606.0" prefWidth="1149.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane>
<children>
<ImageView fx:id="imageView" fitHeight="805.0" fitWidth="1149.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Background.png" />
</image>
<effect>
<DropShadow color="#000000a0" height="41.655" offsetY="4.0" radius="20.896250000000002" width="43.93" />
</effect>
</ImageView>
</children>
</Pane>
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000CC;" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane fx:id="dragImageGridPane">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="dragDropFilesImageView" fitWidth="180.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Files.png" />
</image>
</ImageView>
</children>
</GridPane>
<GridPane fx:id="OCIFStringResutGridPane" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="OCIFStringResultImageView" fitHeight="150.0" fitWidth="369.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/StringResult.png" />
</image>
</ImageView>
<GridPane fx:id="OCIFStringResultGridPane" maxHeight="38.0" maxWidth="312.0" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="-Infinity" prefWidth="38.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<TextField fx:id="OCIFStringResultTextField" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" promptText="Ширина" styleClass="textField" stylesheets="@Styles/OCIFStringTextField.css" text="FFAABBCCAAFFAAFFRRAAVVAAA" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<font>
<Font size="12.0" />
</font>
<GridPane.margin>
<Insets right="8.0" />
</GridPane.margin>
</TextField>
<Button fx:id="OCIFStringResultButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#copyOCIFResultToClipboard" styleClass="defaultButton" stylesheets="@Styles/OCIFStringButton.css" GridPane.columnIndex="1" />
</children>
</GridPane>
</children>
</GridPane>
</children>
</GridPane>
<GridPane fx:id="settingsPane" maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minWidth="0.0" prefWidth="250.0" style="-fx-background-color: #000000D0;" GridPane.halignment="RIGHT" GridPane.valignment="TOP">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="45.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<VBox>
<children>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" prefHeight="20.0" prefWidth="250.0" text="OC Image Converter" textFill="WHITE">
<font>
<Font name="Arial" size="16.0" />
</font>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Label>
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<font>
<Font size="11.0" />
</font>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
<Label fx:id="imageSizeInfoLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="N/A" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
</TextField>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Format" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
<ComboBox fx:id="encodingMethodComboBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onAction="#onTextFieldTextChanged" prefHeight="38.0" stylesheets="@Styles/comboBox.css">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="OCIFString" />
<String fx:value="OCIF5 (Multiscreen)" />
<String fx:value="OCIF6 (Optimized)" />
</FXCollections>
</items>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</ComboBox>
<CheckBox fx:id="keepProportionsCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onProportionsCheckBoxClicked" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Keep proportions" textFill="WHITE">
<VBox.margin>
<Insets left="10.0" top="15.0" />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="brailleCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable Braille font" textFill="WHITE">
<VBox.margin>
<Insets left="10.0" top="12.0" />
</VBox.margin>
</CheckBox>
<GridPane fx:id="ditheringMainPane" prefHeight="120.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane fx:id="ditheringBackgroundPane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: FFFFFF10;">
<children>
<Label fx:id="ditheringOpacityLabel" alignment="CENTER" layoutY="45.0" minHeight="0.0" prefWidth="250.0" text="Opacity" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<Slider fx:id="ditheringOpacitySlider" layoutY="65.0" minHeight="0.0" prefWidth="250.0" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</Slider>
</children></Pane>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<GridPane.margin>
<Insets left="10.0" top="6.0" />
</GridPane.margin>
</CheckBox>
</children>
<VBox.margin>
<Insets top="6.0" />
</VBox.margin>
</GridPane>
</children>
</VBox>
<Button fx:id="convertButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#save" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Convert" GridPane.rowIndex="1">
<font>
<Font size="11.0" />
</font>
</Button>
</children>
<GridPane.margin>
<Insets />
</GridPane.margin>
</GridPane>
</children>
</GridPane>

View File

@ -1,347 +0,0 @@
package sample;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.*;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.*;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.Callback;
import javafx.util.Duration;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.io.File;
import java.io.IOException;
import java.util.regex.Pattern;
public class Main extends Application {
public GridPane mainPane;
public CheckBox keepProportionsCheckBox;
public Button openButton;
public Button convertButton;
public TextField widthTextField;
public TextField heightTextField;
public ImageView imageView;
public CheckBox brailleCheckBox;
public Label imageSizeInfoLabel;
public ComboBox<String> encodingMethodComboBox;
public ImageView dragDropFilesImageView;
public GridPane settingsPane;
public GridPane hintsGridPane;
public GridPane dragImageGridPane;
public GridPane OCIFStringResutGridPane;
public TextField OCIFStringResultTextField;
public ImageView OCIFStringResultImageView;
public GridPane OCIFStringResultGridPane;
public CheckBox ditheringCheckBox;
public GridPane ditheringMainPane;
public Label ditheringOpacityLabel;
public Pane ditheringBackgroundPane;
public Slider ditheringOpacitySlider;
private String currentImagePath = "sample/Resources/Background.png";
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setScene(new Scene(FXMLLoader.load(getClass().getResource("ImageConverter.fxml"))));
primaryStage.show();
}
private Timeline newTimeLine(int duration, KeyValue[] startKeyValues, KeyValue[] endKeyValues) {
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(new Duration(0), startKeyValues));
timeline.getKeyFrames().add(new KeyFrame(new Duration(duration), endKeyValues));
return timeline;
}
private void playAnimation(boolean start, double targetOpacity, double fromScale, double toScale) {
Timeline timeline = newTimeLine(
150,
new KeyValue[] {
// Прозрачность ебалы
new KeyValue(hintsGridPane.opacityProperty(), hintsGridPane.getOpacity()),
// Масштаб пикчи с драг дропом
new KeyValue(dragDropFilesImageView.fitWidthProperty(), dragDropFilesImageView.getImage().getWidth() * fromScale),
// Сдвигание хуйни с настройками
new KeyValue(settingsPane.prefWidthProperty(), start ? 250 : 0),
// Масштаб пикчи и поля конвертации строки
new KeyValue(OCIFStringResultImageView.fitWidthProperty(), OCIFStringResultImageView.getImage().getWidth() * fromScale),
new KeyValue(OCIFStringResultGridPane.maxWidthProperty(), 312 * fromScale)
},
new KeyValue[] {
new KeyValue(hintsGridPane.opacityProperty(), targetOpacity),
new KeyValue(dragDropFilesImageView.fitWidthProperty(), dragDropFilesImageView.getImage().getWidth() * toScale),
new KeyValue(settingsPane.prefWidthProperty(), start ? 0 : 250),
// Масштаб пикчи и поля конвертации строки
new KeyValue(OCIFStringResultImageView.fitWidthProperty(), OCIFStringResultImageView.getImage().getWidth() * toScale),
new KeyValue(OCIFStringResultGridPane.maxWidthProperty(), 312 * toScale),
}
);
timeline.setOnFinished(event -> {
if (!start) {
hintsGridPane.setVisible(false);
}
});
timeline.play();
}
private void playAnimationStart() {
playAnimation(true, 1.0d, 0.8d, 1.0d);
}
private void playAnimationEnd() {
playAnimation(false, 0.0d, 1.0d, 0.8d);
}
public void initialize() {
// Центрируем хуйню самого комбобокса
encodingMethodComboBox.setButtonCell(new ListCell<String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
setText(item);
setAlignment(Pos.CENTER);
Insets old = getPadding();
setPadding(new Insets(old.getTop(), 0, old.getBottom(), 32));
}
}
});
// Центрируем хуйню в выпадающем списке комбобокса
encodingMethodComboBox.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> list) {
return new ListCell<String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
setText(item);
setAlignment(Pos.CENTER);
}
}
};
}
});
encodingMethodComboBox.setValue("OCIF6 (Optimized)");
onTextFieldTextChanged();
}
public void copyOCIFResultToClipboard() {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(OCIFStringResultTextField.getText()), null);
}
//Ебучий драг-дроп
public void onHintsGridPaneDragEntered(DragEvent event) {
hintsGridPane.setVisible(true);
dragImageGridPane.setVisible(true);
OCIFStringResutGridPane.setVisible(false);
if (event.getDragboard().hasFiles()) {
playAnimationStart();
event.acceptTransferModes(TransferMode.COPY);
}
}
public void onHintsGridPaneDragExited(DragEvent event) {
playAnimationEnd();
Dragboard dragboard = event.getDragboard();
if (dragboard.hasFiles()) {
File file = dragboard.getFiles().get(0);
if (file.getAbsolutePath().toLowerCase().matches("^.+\\.(png)?(jpg)?(jpeg)?$")) {
loadImage(file);
}
}
}
public void onHintsGridPaneDragMouseClicked() {
if (hintsGridPane.isVisible()) {
playAnimationEnd();
}
}
public static void main(String[] args) {
launch(args);
}
public void onDitheringStateChanged() {
boolean state = ditheringCheckBox.isSelected();
Timeline timeline = newTimeLine(
150,
new KeyValue[] {
new KeyValue(ditheringBackgroundPane.opacityProperty(), state ? 0 : 1),
new KeyValue(ditheringMainPane.prefHeightProperty(), state ? 38 : 120),
new KeyValue(ditheringOpacitySlider.layoutYProperty(), state ? 38 : 65),
new KeyValue(ditheringOpacityLabel.layoutYProperty(), state ? 38 : 45)
},
new KeyValue[] {
new KeyValue(ditheringBackgroundPane.opacityProperty(), state ? 1 : 0),
new KeyValue(ditheringMainPane.prefHeightProperty(), state ? 120 : 38),
new KeyValue(ditheringOpacitySlider.layoutYProperty(), state ? 65 : 38),
new KeyValue(ditheringOpacityLabel.layoutYProperty(), state ? 45 : 38)
}
);
timeline.setOnFinished(event -> ditheringOpacitySlider.setDisable(!state));
timeline.play();
}
private boolean checkTextField(TextField textField) {
return Pattern.matches("\\d+", textField.getText());
}
private void checkToCalculateHeight() {
if (keepProportionsCheckBox.isSelected()) {
double width = Double.parseDouble(widthTextField.getText());
double imageProportion = imageView.getImage().getWidth() / imageView.getImage().getHeight();
double height = width / imageProportion / 2;
heightTextField.setText(Integer.toString((int) Math.round(height)));
}
}
public void onProportionsCheckBoxClicked() {
heightTextField.setDisable(keepProportionsCheckBox.isSelected());
checkToCalculateHeight();
}
public void onTextFieldTextChanged() {
boolean textFieldsOK = checkTextField(widthTextField) && checkTextField(heightTextField);
if (textFieldsOK) {
checkToCalculateHeight();
}
boolean sizesOK = (textFieldsOK && Integer.parseInt(widthTextField.getText()) <= 255 && Integer.parseInt(heightTextField.getText()) <= 255) || encodingMethodComboBox.getValue().contains("OCIF5");
boolean allOK = sizesOK && textFieldsOK;
imageSizeInfoLabel.setTextFill(allOK ? Color.color(1, 1, 1) : Color.color(1,0.2431,0.2549));
imageSizeInfoLabel.setText(sizesOK ? "Output size for OpenComputers" : (textFieldsOK ? "Size > 255 is only supported by OCIF5 format" : "What the fuck did you write here?"));
convertButton.setDisable(!allOK);
}
private double xDrag = 0, yDrag = 0;
public void onImageDrag(MouseEvent mouseEvent) {
double x = mouseEvent.getScreenX(), y = mouseEvent.getScreenY();
imageView.setLayoutX(imageView.getLayoutX() + (x - xDrag));
imageView.setLayoutY(imageView.getLayoutY() + (y - yDrag));
xDrag = x;
yDrag = y;
}
public void onImageClick(MouseEvent mouseEvent) {
xDrag = mouseEvent.getScreenX();
yDrag = mouseEvent.getScreenY();
}
public void onImageScroll(ScrollEvent scrollEvent) {
double percentage = 0.15;
double newWidth = imageView.getFitWidth() * (1 + (scrollEvent.getDeltaY() > 0 ? percentage : -percentage));
double newHeight = newWidth * (imageView.getImage().getWidth() / imageView.getImage().getHeight());
Timeline timeline = newTimeLine(
100,
new KeyValue[] {
new KeyValue(imageView.fitWidthProperty(), imageView.getFitWidth()),
new KeyValue(imageView.fitHeightProperty(), imageView.getFitHeight())
},
new KeyValue[] {
new KeyValue(imageView.fitWidthProperty(), newWidth),
new KeyValue(imageView.fitHeightProperty(), newHeight)
}
);
timeline.play();
}
private void loadImage(File file) {
if (!file.isDirectory()) {
currentImagePath = "file:" + file.getPath();
javafx.scene.image.Image image = new javafx.scene.image.Image(currentImagePath);
imageView.setImage(image);
checkToCalculateHeight();
}
}
public void open() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open file");
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Images (JPG, PNG)", "*.jpg", "*.jpeg", "*.png"));
File file = fileChooser.showOpenDialog(convertButton.getScene().getWindow());
if (file != null) {
loadImage(file);
}
}
public void save() throws IOException {
if (encodingMethodComboBox.getValue().contains("OCIFString")) {
OCIFStringResultTextField.setText(OCIF.convertToString(
currentImagePath,
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringOpacitySlider.getValue() / 100.0d
));
hintsGridPane.setVisible(true);
dragImageGridPane.setVisible(false);
OCIFStringResutGridPane.setVisible(true);
playAnimationStart();
}
else {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Save file");
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("OpenComputers image", "*.pic"));
File file = fileChooser.showSaveDialog(openButton.getScene().getWindow());
if (file != null) {
OCIF.convert(
currentImagePath,
file.getPath(),
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
encodingMethodComboBox.getValue().contains("OCIF6") ? 6 : 5,
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringOpacitySlider.getValue() / 100.0d
);
}
}
}
}

View File

@ -1,172 +0,0 @@
package sample;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
class OCIF {
private static void writePixelToFileAsOCIF5(FileOutputStream out, Pixel pixel) throws IOException {
out.write((byte) Palette.getClosestIndex(pixel.background));
out.write((byte) Palette.getClosestIndex(pixel.foreground));
out.write((byte) pixel.alpha);
out.write(pixel.symbol.getBytes(StandardCharsets.UTF_8));
}
private static byte[] integerToByteArray(int number, int arraySize) {
byte[] array = new byte[arraySize];
int position = arraySize - 1;
do {
array[position] = (byte) (number & 0xFF);
number = number >> 8;
position--;
} while (number > 0);
while (position >= 0) {
array[position] = 0x0;
position--;
}
return array;
}
private static void writeGroupedImage(FileOutputStream out, HashMap<Integer, HashMap<String, HashMap<Integer, HashMap<Integer, HashMap<Integer, ArrayList<Integer>>>>>> groupedImage) throws IOException {
// Alphas size
out.write(groupedImage.keySet().size());
for (Integer alpha : groupedImage.keySet()) {
// Alpha
out.write(alpha.byteValue());
// Symbols size
out.write(integerToByteArray(groupedImage.get(alpha).keySet().size(), 2));
for (String symbol : groupedImage.get(alpha).keySet()) {
// Symbol
out.write(symbol.getBytes(StandardCharsets.UTF_8));
// Backgrounds size
out.write((byte) groupedImage.get(alpha).get(symbol).keySet().size());
for (Integer background : groupedImage.get(alpha).get(symbol).keySet()) {
// Background
out.write(background.byteValue());
// Foregrounds size
out.write((byte) groupedImage.get(alpha).get(symbol).get(background).keySet().size());
for (Integer foreground : groupedImage.get(alpha).get(symbol).get(background).keySet()) {
// Foreground
out.write(foreground.byteValue());
// Ys size
out.write((byte) groupedImage.get(alpha).get(symbol).get(background).get(foreground).keySet().size());
for (Integer y : groupedImage.get(alpha).get(symbol).get(background).get(foreground).keySet()) {
// Y
out.write(y.byteValue());
// Xs size
out.write((byte) groupedImage.get(alpha).get(symbol).get(background).get(foreground).get(y).size());
for (Integer x : groupedImage.get(alpha).get(symbol).get(background).get(foreground).get(y)) {
// X
out.write(x.byteValue());
}
}
}
}
}
}
}
private static sample.Image loadImage(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double opacity) {
sample.Image image = new sample.Image(new javafx.scene.image.Image(imagePath,
requestedWidth * (convertAsBraille ? 2 : 1),
requestedHeight * (convertAsBraille ? 4 : 2),
false,
true
));
if (enableDithering) {
image = sample.Image.dither(image, opacity);
}
return image;
}
private static void appendPixel(StringBuilder result, Pixel pixel) {
result.append(String.format("%02X", Palette.getClosestIndex(pixel.background)));
result.append(String.format("%02X", Palette.getClosestIndex(pixel.foreground)));
result.append(String.format("%02X", pixel.alpha));
result.append(pixel.symbol);
}
static String convertToString(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double opacity) {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, opacity);
StringBuilder result = new StringBuilder();
result.append(String.format("%02X", requestedWidth));
result.append(String.format("%02X", requestedHeight));
if (convertAsBraille) {
for (int y = 0; y < image.height; y += 4) {
for (int x = 0; x < image.width; x += 2) {
appendPixel(result, sample.Image.getBraillePixel(image, x, y));
}
}
}
else {
for (int y = 0; y < image.height; y += 2) {
for (int x = 0; x < image.width; x += 1) {
appendPixel(result, sample.Image.getSemiPixel(image, x, y));
}
}
}
return result.toString();
}
static void convert(String imagePath, String convertedImagePath, int requestedWidth, int requestedHeight, int encodingMethod, boolean convertAsBraille, boolean enableDithering, double opacity) throws IOException {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, opacity);
FileOutputStream out = new FileOutputStream(convertedImagePath);
out.write("OCIF".getBytes(StandardCharsets.US_ASCII));
out.write((byte) encodingMethod);
if (encodingMethod == 5) {
out.write(integerToByteArray(requestedWidth, 2));
out.write(integerToByteArray(requestedHeight, 2));
}
else{
out.write((byte) requestedWidth);
out.write((byte) requestedHeight);
}
if (convertAsBraille) {
if (encodingMethod == 5) {
for (int y = 0; y < image.height; y += 4) {
for (int x = 0; x < image.width; x += 2) {
writePixelToFileAsOCIF5(out, sample.Image.getBraillePixel(image, x, y));
}
}
}
else {
writeGroupedImage(out, sample.Image.groupAsBraille(image));
}
}
else {
if (encodingMethod == 5) {
for (int y = 0; y < image.height; y += 2) {
for (int x = 0; x < image.width; x += 1) {
writePixelToFileAsOCIF5(out, sample.Image.getSemiPixel(image, x, y));
}
}
}
else {
writeGroupedImage(out, sample.Image.groupAsSemiPixel(image));
}
}
out.close();
}
}

View File

@ -1,43 +0,0 @@
package sample;
public class Palette {
private static int[] palette = { 0x000000, 0x000040, 0x000080, 0x0000BF, 0x0000FF, 0x002400, 0x002440, 0x002480, 0x0024BF, 0x0024FF, 0x004900, 0x004940, 0x004980, 0x0049BF, 0x0049FF, 0x006D00, 0x006D40, 0x006D80, 0x006DBF, 0x006DFF, 0x009200, 0x009240, 0x009280, 0x0092BF, 0x0092FF, 0x00B600, 0x00B640, 0x00B680, 0x00B6BF, 0x00B6FF, 0x00DB00, 0x00DB40, 0x00DB80, 0x00DBBF, 0x00DBFF, 0x00FF00, 0x00FF40, 0x00FF80, 0x00FFBF, 0x00FFFF, 0x0F0F0F, 0x1E1E1E, 0x2D2D2D, 0x330000, 0x330040, 0x330080, 0x3300BF, 0x3300FF, 0x332400, 0x332440, 0x332480, 0x3324BF, 0x3324FF, 0x334900, 0x334940, 0x334980, 0x3349BF, 0x3349FF, 0x336D00, 0x336D40, 0x336D80, 0x336DBF, 0x336DFF, 0x339200, 0x339240, 0x339280, 0x3392BF, 0x3392FF, 0x33B600, 0x33B640, 0x33B680, 0x33B6BF, 0x33B6FF, 0x33DB00, 0x33DB40, 0x33DB80, 0x33DBBF, 0x33DBFF, 0x33FF00, 0x33FF40, 0x33FF80, 0x33FFBF, 0x33FFFF, 0x3C3C3C, 0x4B4B4B, 0x5A5A5A, 0x660000, 0x660040, 0x660080, 0x6600BF, 0x6600FF, 0x662400, 0x662440, 0x662480, 0x6624BF, 0x6624FF, 0x664900, 0x664940, 0x664980, 0x6649BF, 0x6649FF, 0x666D00, 0x666D40, 0x666D80, 0x666DBF, 0x666DFF, 0x669200, 0x669240, 0x669280, 0x6692BF, 0x6692FF, 0x66B600, 0x66B640, 0x66B680, 0x66B6BF, 0x66B6FF, 0x66DB00, 0x66DB40, 0x66DB80, 0x66DBBF, 0x66DBFF, 0x66FF00, 0x66FF40, 0x66FF80, 0x66FFBF, 0x66FFFF, 0x696969, 0x787878, 0x878787, 0x969696, 0x990000, 0x990040, 0x990080, 0x9900BF, 0x9900FF, 0x992400, 0x992440, 0x992480, 0x9924BF, 0x9924FF, 0x994900, 0x994940, 0x994980, 0x9949BF, 0x9949FF, 0x996D00, 0x996D40, 0x996D80, 0x996DBF, 0x996DFF, 0x999200, 0x999240, 0x999280, 0x9992BF, 0x9992FF, 0x99B600, 0x99B640, 0x99B680, 0x99B6BF, 0x99B6FF, 0x99DB00, 0x99DB40, 0x99DB80, 0x99DBBF, 0x99DBFF, 0x99FF00, 0x99FF40, 0x99FF80, 0x99FFBF, 0x99FFFF, 0xA5A5A5, 0xB4B4B4, 0xC3C3C3, 0xCC0000, 0xCC0040, 0xCC0080, 0xCC00BF, 0xCC00FF, 0xCC2400, 0xCC2440, 0xCC2480, 0xCC24BF, 0xCC24FF, 0xCC4900, 0xCC4940, 0xCC4980, 0xCC49BF, 0xCC49FF, 0xCC6D00, 0xCC6D40, 0xCC6D80, 0xCC6DBF, 0xCC6DFF, 0xCC9200, 0xCC9240, 0xCC9280, 0xCC92BF, 0xCC92FF, 0xCCB600, 0xCCB640, 0xCCB680, 0xCCB6BF, 0xCCB6FF, 0xCCDB00, 0xCCDB40, 0xCCDB80, 0xCCDBBF, 0xCCDBFF, 0xCCFF00, 0xCCFF40, 0xCCFF80, 0xCCFFBF, 0xCCFFFF, 0xD2D2D2, 0xE1E1E1, 0xF0F0F0, 0xFF0000, 0xFF0040, 0xFF0080, 0xFF00BF, 0xFF00FF, 0xFF2400, 0xFF2440, 0xFF2480, 0xFF24BF, 0xFF24FF, 0xFF4900, 0xFF4940, 0xFF4980, 0xFF49BF, 0xFF49FF, 0xFF6D00, 0xFF6D40, 0xFF6D80, 0xFF6DBF, 0xFF6DFF, 0xFF9200, 0xFF9240, 0xFF9280, 0xFF92BF, 0xFF92FF, 0xFFB600, 0xFFB640, 0xFFB680, 0xFFB6BF, 0xFFB6FF, 0xFFDB00, 0xFFDB40, 0xFFDB80, 0xFFDBBF, 0xFFDBFF, 0xFFFF00, 0xFFFF40, 0xFFFF80, 0xFFFFBF, 0xFFFFFF };
public static int getClosestIndex(Color color) {
int closestIndex = 0;
double delta, closestDelta = 999999999.0d;
Color paletteColor;
for (int i = 0; i < palette.length; i++) {
paletteColor = new Color(
0x0,
palette[i] >> 16,
(palette[i] >> 8) & 0xFF,
palette[i] & 0xFF
);
delta = Math.pow((double) (paletteColor.red - color.red), 2) +
Math.pow((double) (paletteColor.green - color.green), 2) +
Math.pow((double) (paletteColor.blue - color.blue), 2);
if (delta < closestDelta) {
closestDelta = delta;
closestIndex = i;
}
}
return closestIndex;
}
public static Color getColor(int paletteIndex)
{
return new Color(0xFF000000 | palette[paletteIndex]);
}
public static Color getClosestColor(Color color)
{
return getColor(getClosestIndex(color));
}
}

View File

@ -1,16 +0,0 @@
package sample;
public class Pixel {
Color background;
Color foreground;
int alpha;
String symbol;
public Pixel(Color background, Color foreground, int alpha, String symbol) {
this.background = background;
this.foreground = foreground;
this.alpha = alpha;
this.symbol = symbol;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Some files were not shown because too many files have changed in this diff Show More